Why do you need a wrapper? Those API functions are very simple. The code will be really small. The QueryPerformanceFrequency gives you the frequency of the performance counter on the system and I believe it takes a pointer to a LARGE_INTEGER structure.
The QueryPerformanceCounter takes one parameter, a pointer to a LARGE_INTEGER structure. You use that to time your loops and the like. Of course, continually polling the Performance Counter for anything greater than or equal to ms resolution is not a good practice. This will use up 100% CPU needlessly and will be enough for most x86 CPU's to heat up quite rapidly.
This function looks decent but it is using the RDTSC and not the performance counter. Also you seem to be putting a fixed frequency into the structure. Do not do this. Detect the processor frequency. To get a rough sampling of the processor clock frequency, sample the TSC using the RDTSC instruction, save it, do a Sleep(1000) API call and then sample it again and simply calculate the difference. You can do it multiple times to increase the accuracy of course.
This looks alright too, but again using the time stamp counter.
The way you are using the TSC is meaningful. It's just not a good idea to use the TSC or performance counter to time periodic events in the ms resolution.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.