X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2Fposix%2FGetTime.c;h=3a0764cb91cf5094ef672630aee6f7b351323ce7;hb=acc7c96112e6554461ec6704f27fe4ae3fa7aae2;hp=825ede69e1d5946b917e805a8ec32ad6192d62be;hpb=cc2926f3a6942e6c512bb64bfe2c2a6aae2c72b4;p=ghc-hetmet.git diff --git a/ghc/rts/posix/GetTime.c b/ghc/rts/posix/GetTime.c index 825ede6..3a0764c 100644 --- a/ghc/rts/posix/GetTime.c +++ b/ghc/rts/posix/GetTime.c @@ -6,7 +6,9 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +// Not POSIX, due to use of ru_majflt in getPageFaults() +// #include "PosixSource.h" + #include "Rts.h" #include "GetTime.h" @@ -34,7 +36,7 @@ #error No implementation for getProcessCPUTime() available. #endif -#if (defined(HAVE_GETTIMEOFDAY) && defined(HAVE_GETRUSAGE) && !irix_HOST_OS) +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_GETRUSAGE) && !irix_HOST_OS // we'll implement getProcessCPUTime() and getProcessElapsedTime() // separately, using getrusage() and gettimeofday() respectively @@ -113,13 +115,13 @@ void getProcessTimes(Ticks *user, Ticks *elapsed) Ticks getThreadCPUTime(void) { -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_THREAD_CPUTIME_ID) // clock_gettime() gives us per-thread CPU time. It isn't // 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 + - ts.tv_nsec / (1000000000/TICKS_PER_SECOND)); + ((Ticks)ts.tv_nsec * TICKS_PER_SECOND) / 1000000000); #else return getProcessCPUTime(); #endif