Message 2 of 4
12 Feb 18 13:36
Join Date: 28 Jan 2005
Posts To This List: 11922
milli/micro/nano seconds to cpu ticks conversion
> --->I am porting one driver from linux to windows.we are using KMDF.Like
"msecs_to_jiffies" in linux, in windows how can i convert milli seconds to cpu
> --->I googled and i found "KeQueryPerformanceCounter" instruction.
> --->What is Performence counter?
> --->How can i use this instruction to meet my requirement?
That's not a requirement, that's an implementation detail.Â Why do you
need the time in "jiffies"?Â What is the actual requirement?Â In almost
every case, you want to go the other direction -- you have a
CPU-specific time period, and you want the value in microseconds or
milliseconds.Â Hardware devices NEVER work in "jiffies".
You should also understand that the Linux "jiffy" is not "CPU ticks".Â
It is the time between timer interrupts, typically a value between 1ms
and 10ms.Â Windows has a similar range, from 1ms to 16ms.
The exact source of KeQueryPerformanceCounter depends on the hardware
and the operating system version.Â In olden days, it was based on the
motherboard countdown timer, which was also used to generate the timer
interrupt.Â Later, it came from the High-Precision Event Timer (HPET).Â
These days, it is commonly derived from the CPU cycle counters.Â
KeQueryPerformanceCounter also returns to you the frequency of the
counter, so you can derive meaningful time from the value.
Tim Roberts, email@example.com
Providenza & Boekelheide, Inc.