diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-04-02 15:19:23 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-14 07:55:55 -0400 |
commit | 074c1ccd3f8c3fcab117e336316173e8e869230a (patch) | |
tree | a16c43ccb73e315974397cb0bdd049114bc4bd7a | |
parent | 0da186c1b5a47e08e91c1c674d46c040c83932fc (diff) | |
download | haskell-074c1ccd3f8c3fcab117e336316173e8e869230a.tar.gz |
Small change to the windows ticker.
We already have a function to go from time to ms so use it.
Also expand on the state of timer resolution.
-rw-r--r-- | rts/win32/Ticker.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rts/win32/Ticker.c b/rts/win32/Ticker.c index 27c9070a50..36dbd222b9 100644 --- a/rts/win32/Ticker.c +++ b/rts/win32/Ticker.c @@ -30,6 +30,12 @@ static VOID CALLBACK tick_callback( // be very useful for profiling with a max usable resolution of // 15ms. Unfortunately we don't have anything better. +// Update as of 2020-04-02: +// It seems we can get somewhat reliable resolution even for intervals +// at 1ms which had an average error of <5%. +// This seems to be the case starting at some point during the +// Windows 7 lifetime and any newer versions of windows. + void initTicker (Time interval, TickProc handle_tick) { @@ -53,7 +59,7 @@ startTicker(void) tick_callback, 0, 0, - TimeToUS(tick_interval) / 1000, // ms + TimeToMS(tick_interval), // ms WT_EXECUTEINTIMERTHREAD); if (r == 0) { sysErrorBelch("CreateTimerQueueTimer"); |