[GHC] #2140: cpuTimePrecision is wrong for me on Windows (XP)
GHC
trac at galois.com
Mon May 12 09:19:27 EDT 2008
#2140: cpuTimePrecision is wrong for me on Windows (XP)
----------------------------+-----------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.10 branch
Component: libraries/base | Version: 6.8.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86_64 (amd64)
Os: Windows |
----------------------------+-----------------------------------------------
Comment (by guest):
I use getCPUTime to measure the start and end times of some code I want to
benchmark and need to know cpuTimePrecision to ensure that time
quantisation is not a significant source of error and to normalise the
times to some grokable number of "ticks".
I don't know what part of windows API should be used for this, but 15.625
mS seems too coarse resolution (at least 4 orders of magnitude too coarse
assuming a non-brain dead OS) and the figure given by cpuTimePrecision is
in any case wrong.
If it can't be made right then it would be better not to have it at all,
or have some function which determines it empirically (you could use
unsafePerformIO to keep the existing API I guess).
Unfortunately the mess that is MSDN doesn't make it at all easy to figure
out what can or should be done about this. I can't figure it out but
perhaps someone else knows.
The queryPerformanceFrequency and queryPerformanceCounter functions seem
to offer better resolution, but AFAICT measure "wall clock" time rather
than CPU time and may not be available on all windows systems (according
to MSDN).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2140#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list