What is the resolution of windows high performance counter?

c++, windows

Solution

Some googling around provided no concrete answer for me.

First Google search result for "QueryPerformanceCounter": the MSDN documentation for `QueryPerformanceCounter()`

Here's what it has to say:

Parameters

lpPerformanceCount [out]

Type: LARGE_INTEGER*

A pointer to a variable that receives the current performance-counter value, in counts.

First Google search result for "QueryPerformanceFrequency": the MSDN documentation for `QueryPerformanceFrequency()`

Here's what it has to say:

Parameters

lpFrequency [out]

Type: LARGE_INTEGER*

A pointer to a variable that receives the current performance-counter frequency, in counts per second. If the installed hardware does not support a high-resolution performance counter, this parameter can be zero.

The value obtained from `QueryPerformanceCounter()` is in counts. The value obtained from `QueryPerformanceFrequency()` is in counts per second. Using a bit of dimensional analysis:

(counts) / (counts/second) = seconds

Therefore, the result of dividing the two values is in seconds.

Problem

This might seem like a really basic question but, When dividing the output of `QueryPerformanceCounter` with `QueryPerformanceFrequency`, what is the resulting value in, i.e. seconds, milliseconds, microseconds? I'm asking because I'm porting some code from Windows to Linux and I don't have a windows machine handy to experiment with. Some googling around provided no concrete answer for me.

Original source

Related problems