But, what is an auxiliary counter?
You can determine the auxiliary counter source by frequency. The auxiliary counter frequency on my machine is 24000000 which is the HPET hardware timer:
QueryPerformanceFrequency: 10000000 (10 MHz)
QueryAuxiliaryCounterFrequency: 24000000 (24 MHz)
And why would you want to use one?
There's a few use cases but generally correlating events and time-stamps from multiple machines over a network or determining the reliability or accuracy of other timers on the system.
And how do you actually read the value of an auxiliary counter?
The API is designed to convert QPC values to the equivalent AUX counter:
LARGE_INTEGER PerformanceCounterValue;
ULONG64 AuxiliaryCounterValue;
ULONG64 AuxiliaryConversionError;
QueryPerformanceCounter(&PerformanceCounterValue);
ConvertPerformanceCounterToAuxiliaryCounter(
PerformanceCounterValue.QuadPart,
&AuxiliaryCounterValue,
&AuxiliaryConversionError
);
printf("%llu +/- %llu", AuxiliaryCounterValue, AuxiliaryConversionError);
The function will fail with E_BOUNDS for QPC values that are outside a range of 10 seconds.
Convert QPC to AUX with ConvertPerformanceCounterToAuxiliaryCounter and the other party would convert AUX back to QPC with ConvertAuxiliaryCounterToPerformanceCounter and you have the AUX timestamp for high precision correlation of events from multiple machines across a network, QPC for high precision correlation of local events, without accumulating an increasing number of frequency offset errors
mentioned in the MSDN documentation: https://learn.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps#resolution-precision-accuracy-and-stability
Consider using two different computers to measure the same 24 hour time interval. Both computers have an oscillator with a maximum frequency offset of ± 50 ppm. How far apart can the measurement of the same time interval on these two systems be? As in the previous examples, ± 50 ppm yields a maximum error of ± 4.3 seconds after 24 hours. If one system runs 4.3 seconds fast, and the other 4.3 seconds slow, the maximum error after 24 hours could be 8.6 seconds.
Seconds in a day = 86400
Frequency offset error = ±50 ppm = ±0.00005
±(86,400 seconds * 0.00005) = ±4.3 seconds
Maximum offset between the two systems = 8.6 seconds
In summary, the frequency offset error becomes increasingly important when measuring long time intervals and when comparing measurements between different systems.