Skip to content
  • Ben Gamari's avatar
    base: Rework System.CPUTime · cb3456d8
    Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
    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
    cb3456d8