DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.59k stars 552 forks source link

i#6640: Switch to QueryPerformanceCounter for scheduler on Windows #6641

Closed derekbruening closed 5 months ago

derekbruening commented 5 months ago

Switches from GetSystemTime on Windows to QueryPerformanceCounter in scheduler and related drmemtrace code. GetSystemTime was returning times that did not have microsecond granularity, causing problems with identical timestamps. QueryPerformanceCounter is not an absolute time but none of the use cases need that: they just need relative orderings.

Tested on a Windows machine where GetSystemTime returned the same value repeatedly in the test_random_schedule() test from PR #6639:

5: time is 133518165841993473
5: time is 133518165841993473
5: time is 133518165841993473
5: time is 133518165841993473

While QueryPerformanceCounter changes:

5: time is 3353910786292
5: time is 3353910787556
5: time is 3353910810719
5: time is 3353910811957

Fixes #6640