[commit: ghc] master: base: Rework System.CPUTime (cb3456d)
git at git.haskell.org
git at git.haskell.org
Sun Mar 20 21:12:01 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/cb3456d82eaa8cea6b393273f0c81c57fb760ee5/ghc
>---------------------------------------------------------------
commit cb3456d82eaa8cea6b393273f0c81c57fb760ee5
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Sun Mar 20 17:56:24 2016 +0100
base: Rework System.CPUTime
This started when I noticed that `getCPUTime` only provides 1
millisecond resolution on Linux. Unfortunately the previous
implementation was quite unmaintainable, so this ended up being a bit
more involved than I expected.
Here we do several things,
* Split up `System.CPUTime`
* Add support for `clock_gettime`, allowing for significantly more
precise timing information when available
* Fix System.CPUTime resolution for Windows. While it's hard to get
reliable numbers, the consensus is that Windows only provides 16
millisecond resolution in GetProcessTimes (see Python PEP 0418 [1])
* Eliminate terrible hack wherein we would cast between `CTime` and
`Integer` through `Double`
[1] https://www.python.org/dev/peps/pep-0418/#id59
Test Plan: Validate on various platforms
Reviewers: austin, hvr, erikd
Reviewed By: erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2001
>---------------------------------------------------------------
cb3456d82eaa8cea6b393273f0c81c57fb760ee5
libraries/base/System/CPUTime.hsc | 148 ++++-----------------
.../base/System/CPUTime/Posix/ClockGetTime.hsc | 55 ++++++++
libraries/base/System/CPUTime/Posix/RUsage.hsc | 42 ++++++
libraries/base/System/CPUTime/Posix/Times.hsc | 39 ++++++
libraries/base/System/CPUTime/Unsupported.hs | 20 +++
libraries/base/System/CPUTime/Utils.hs | 19 +++
libraries/base/System/CPUTime/Windows.hsc | 66 +++++++++
libraries/base/base.cabal | 8 ++
8 files changed, 276 insertions(+), 121 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc cb3456d82eaa8cea6b393273f0c81c57fb760ee5
More information about the ghc-commits
mailing list