Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

RE: How often could I use KeQueryPerfomanceCounter function

Jake_OshinsJake_Oshins Member Posts: 1,058
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" <xxxxx@mail.ru>
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?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Developing Minifilters 29 July 2019 OSR Seminar Space
Writing WDF Drivers 23 Sept 2019 OSR Seminar Space
Kernel Debugging 21 Oct 2019 OSR Seminar Space
Internals & Software Drivers 18 Nov 2019 Dulles, VA