File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -222,15 +222,20 @@ callQP qpfunc =
222
222
--
223
223
-- Problems:
224
224
--
225
+ -- * Might not be available on some hardware. Use 'queryPerformanceFrequency'
226
+ -- to test for availability before calling this function.
227
+ --
225
228
-- * On a multiprocessor computer, may produce different results on
226
229
-- different processors due to hardware bugs.
227
230
--
228
231
-- To get a monotonic time in seconds, divide the result of
229
232
-- 'queryPerformanceCounter' by that of 'queryPerformanceFrequency'.
230
233
--
231
234
-- <http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904%28v=vs.85%29.aspx>
232
- queryPerformanceCounter :: IO (Maybe Int64 )
233
- queryPerformanceCounter = callQP c_QueryPerformanceCounter
235
+ queryPerformanceCounter :: IO Int64
236
+ queryPerformanceCounter =
237
+ callQP c_QueryPerformanceCounter
238
+ >>= maybe (Win32. errorWin " QueryPerformanceCounter" ) return
234
239
235
240
-- | Call the @QueryPerformanceFrequency@ function. Return 'Nothing' if the
236
241
-- hardware does not provide a high-resolution performance counter.
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ main = do
29
29
t64 <- maybe (return Nothing ) (fmap Just ) gtc64
30
30
qpc <- case freq of
31
31
Nothing -> return Nothing
32
- Just f -> fmap (\ c -> (c, f)) <$> queryPerformanceCounter
32
+ Just f -> (\ c -> Just (c, f)) <$> queryPerformanceCounter
33
33
putStrLn $ formatTimes t t64 qpc
34
34
35
35
formatTimes t t64 qpc =
You can’t perform that action at this time.
0 commit comments