GetCPUTime returns only two values ​​(0 or 15625000000) - is this correct?

It seems that it always returns 0or 15625000000.

import System.CPUTime

main  =  do         
    print =<< getCPUTime
    getLine
    print =<< getCPUTime
    getLine
    return ()

Execution

>>time.exe
15625000000

15625000000


>>time.exe
0

0


>>time.exe
0

15625000000


>>time.exe
0

0

I am on Windows, I think this is platform related.

+4
source share
2 answers

getCPUTimereturns the processor time used by your process. Since your process does practically nothing, it always returns 0 or the next closest thing (which seems to be 15625000000 on your platform). Please note that the time during which your process blocks waiting for input is not taken into account as the processor time of your process.

+3
source

From hoogle

getCPUTime :: IO Integer

base System.CPUTime

getCPUTime , . .

, 0 , , linux osx.

+4

All Articles