summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-04-02 15:19:23 +0200
committerAndreas Klebinger <klebinger.andreas@gmx.at>2020-04-13 07:52:16 -0400
commit6b75e2c959291bf320b0520c5fccf98322753388 (patch)
tree294acfe94b7e9f6972a480793357c31ff825b952
parente8029816fda7602a8163c4d2703ff02982a3e48c (diff)
downloadhaskell-wip/andreask/ticker_comments.tar.gz
Small change to the windows ticker.wip/andreask/ticker_comments
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.c8
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");