If the windows kernel was waiting for time-slice boundaries (typically 10 to 15ms) then calls to queryPerformanceCounter would have a 15ms overhead. It is ridiculous to think that queryPerformanceCounter could have less resolution than getlocaltime!Quote from damir00:
right. a system call, which will get executed based on a system time slice boundary. you see the problem, right? you're now dealing with 2 separate discretizations of time. this gets hairy in a hurry, and the problems are grossly magnified when running multiple processors.
This source http://www-106.ibm.com/developerworks/linux/library/l-rt1/ measured the overhead of queryPerformanceCounter at 2 microseconds. Linux gives less than 1us with gettimeofday(). So yes, Linux is better here, but not dramatically so. The previous link I posted measured 1.5 and 5.7us resolution for 933 and 333 MHz CPUs respectively. Overhead scales with cpu speed. Clearly the windows scheduler is switching immediately to the kernel for calls to queryPerformanceCounter. It is not waiting for regular time-slice boundaries. If it did it would be useless!
