diff options
author | Ian Lynagh <igloo@earth.li> | 2006-09-11 22:32:10 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2006-09-11 22:32:10 +0000 |
commit | 186a80cbcfbe0490ddd153e5f75faac23f4e5021 (patch) | |
tree | 8bcb8f900fafa9bccde70c4dc2e65e2fe554fff0 /rts/posix | |
parent | 917c16c4f408b2b463f9834d2f0f937a4862c046 (diff) | |
download | haskell-186a80cbcfbe0490ddd153e5f75faac23f4e5021.tar.gz |
Fix ~2000 second profiling time wrapping bug
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/GetTime.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c index 89d83a31cb..0e591ef551 100644 --- a/rts/posix/GetTime.c +++ b/rts/posix/GetTime.c @@ -44,7 +44,7 @@ Ticks getProcessCPUTime(void) { struct rusage t; getrusage(RUSAGE_SELF, &t); - return (t.ru_utime.tv_sec * TICKS_PER_SECOND + + return ((Ticks)t.ru_utime.tv_sec * TICKS_PER_SECOND + ((Ticks)t.ru_utime.tv_usec * TICKS_PER_SECOND)/1000000); } @@ -52,7 +52,7 @@ Ticks getProcessElapsedTime(void) { struct timeval tv; gettimeofday(&tv, (struct timezone *) NULL); - return (tv.tv_sec * TICKS_PER_SECOND + + return ((Ticks)tv.tv_sec * TICKS_PER_SECOND + ((Ticks)tv.tv_usec * TICKS_PER_SECOND)/1000000); } @@ -120,7 +120,7 @@ Ticks getThreadCPUTime(void) // reliable on Linux, but it's the best we have. struct timespec ts; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); - return (ts.tv_sec * TICKS_PER_SECOND + + return ((Ticks)ts.tv_sec * TICKS_PER_SECOND + ((Ticks)ts.tv_nsec * TICKS_PER_SECOND) / 1000000000); #else return getProcessCPUTime(); |