I would like to use the High Performance Event Timer (HPET) for an profiling tool to take very high precision measurements, quickly. timeGetTime does not provide sufficient resolution at 1ms, and QueryPerformanceCounter is much slower per read than I'd like. I came across the HPET while researching the problem, but I can't see any samples of how to actually get at it.
So can I use it directly (assembly is fine), or do I have to rely on the multimedia/high performance timing tools already built into the Win32 API?
If you are using Win7 or higher, then it doesn't have it enabled by default. Enabled in BIOS doesn't mean it is being used. Win10 uses a much more efficient TSC on the CPU as default, regardless of HPET being enabled in BIOS. You'll only use HPET if a specific program was made to use it.
From the System Utilities screen, select System Configuration > BIOS/Platform Configuration (RBSU) > Advanced Options > High Precision Event Timer (HPET) ACPI Support. Select a setting. Enabled—The HPET is available to an operating system that supports it using the industry standard ACPI name space.
Disabling HPET distorts the system's understanding of time, which causes the system to miscount the frames in a second. If one second isn't one second, then FPS isn't FPS anymore. This data is invalid. Most games use a function called QueryPerformanceCounter() call it "QPC" for short.
I am also interested in using the HPET, but as a timer. The way I understand it, QueryPerformanceCounter and QueryPerformanceFrequency are actually accessing the counter and clock for the HPET, and this works under Windows XP (see, for example, http://www.geisswerks.com/ryan/FAQS/timing.html).
So as far as timing code, I think by using QueryPerformanceCounter you are in fact getting access to the counter that form the base of HPET, and this is all present in the chipset (rather than the processor).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With