RE: How often could I use KeQueryPerfomanceCounter function

Does it really say “oftenly?” It should say “frequently.” Oh well…

But, to answer your question, KeQueryPerformanceCounter has a cost, but
it’s a small one. Just don’t sit in a loop calling it. If you want to
wait for periods of time, then set the timer resolution (using
ExSetTimerResolution) to what you need and then set a timer for the time
you need to wait for. If you need to wait for periods of time that are
much smaller than 1ms, then call KeStallExecutionProcessor.

KeQPC is far more appropriate for creating timestamps for events. It’s
actual cost is usually one or two “in” instructions. That will cause
some I/O bus serialization, but not much. The multi-processor
implemenations of it just read the internal Time Stamp Counter, though
that approach won’t last much longer, since the introduction of Intel’s
HyperThreaded processors will bring processor power management into
multi-processor systems, making the TSC less useful.

Jake Oshins
Windows Kernel Group

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
Subject: How offen could I use KeQueryPerfomanceCounter function
From: “Akorolev”
Date: Thu, 24 Oct 2002 13:41:44 -0400
X-Message-Number: 17

KeQueryPerfomanceCounter is a very useful function to measure time. But
DDK doesn’t recomend to use it oftenly. I didn’t understant what does it
mean (oftenly)? Is it normal, if I will call it every 10ms?
What does this function do?