On Wed, Mar 27, 2013 at 9:46 AM, Dan Kemppainen <d...@irtelemetrics.com>wrote:

>
> As for timing things on windows, check out how to read the performance
> counters in windows. I believe these are QueryPerformanceCounter and
>  QueryPerformanceFrequency in kernel32. In most modern systems these should
> give a time stamp from the system start, at the native core clock frequency.
>


If you use those, you have to lock the thread you are timing to one
CPU/Core as the performance counters are per CPU/Core and can get out of
step.  Or you can force your thread onto one CPU for the
QueryPerformanceCounter call.  This seems to be a bad idea to me as it
would add an indeterminate time before querying the counter (indeterminate
as if you are running on a different CPU, the OS would have to switch to
the one you requested).

Search for SetThreadAffinityMask and/or SetProcessAffinityMask along with
QueryPerformanceCounter.

Then all bets are off if you have a CPU that runs at variable speed if you
want the result to be actual time.

Orin.
_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to