Question

I'm using KeQueryPerformanceCounter to get the number of ticks per second.

I understand this is the performance counter frequency, in ticks per second. I don't know how to convert this to a unit of time(let's say seconds, milli-seconds or nano-seconds.. anything) ?

How many ticks constitute a second ? What is the conversion factor ?

LARGE_INTEGER freq;
KeQueryPerformanceCounter(&freq);
Was it helpful?

Solution

In the link:

Remarks

KeQueryPerformanceCounter always returns a 64-bit integer that represents the current value of a monotonically nondecreasing counter. The counter starts incrementing from zero when the computer starts up.

To get the resolution of the timer used to accumulate the current tick count, specify a non-NULL pointer value for the PerformanceFrequency parameter. The frequency value that the routine writes to the location pointed to by this parameter is the number of ticks per second.

Here, it means that freq variable will contain ticks per second

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top