Commit 256c1b39 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files

rts: drop unused getThreadCPUTime

Use of this helper function was removed in:

    commit 3c9fc104


    Author: Brian Brooks <brooks.brian@gmail.com>
    Date:   Thu Jul 10 02:55:33 2014 -0500

        Avoid unnecessary clock_gettime() syscalls in GC stats.

Noticed by uselex.rb:
    getThreadCPUTime: [R]: exported from:
        ./rts/dist/build/posix/GetTime.p_o
Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
parent 4f283a6f
......@@ -14,7 +14,6 @@
void initializeTimer (void);
Time getProcessCPUTime (void);
Time getThreadCPUTime (void);
Time getProcessElapsedTime (void);
void getProcessTimes (Time *user, Time *elapsed);
......
......@@ -171,36 +171,6 @@ void getProcessTimes(Time *user, Time *elapsed)
#endif // HAVE_TIMES
Time getThreadCPUTime(void)
{
#if !defined(BE_CONSERVATIVE) && \
defined(HAVE_CLOCK_GETTIME) && \
defined(_SC_CPUTIME) && \
defined(CLOCK_PROCESS_CPUTIME_ID) && \
defined(HAVE_SYSCONF)
{
static int checked_sysconf = 0;
static int sysconf_result = 0;
if (!checked_sysconf) {
sysconf_result = sysconf(_SC_THREAD_CPUTIME);
checked_sysconf = 1;
}
if (sysconf_result != -1) {
// clock_gettime() gives us per-thread CPU time. It isn't
// reliable on Linux, but it's the best we have.
struct timespec ts;
int res;
res = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
if (res == 0) {
return SecondsToTime(ts.tv_sec) + NSToTime(ts.tv_nsec);
}
}
}
#endif
return getProcessCPUTime();
}
void getUnixEpochTime(StgWord64 *sec, StgWord32 *nsec)
{
#if defined(HAVE_GETTIMEOFDAY)
......
......@@ -100,19 +100,6 @@ getProcessElapsedTime(void)
return NSToTime(getMonotonicNSec());
}
Time
getThreadCPUTime(void)
{
FILETIME creationTime, exitTime, userTime, kernelTime = {0,0};
if (!GetThreadTimes(GetCurrentThread(), &creationTime,
&exitTime, &kernelTime, &userTime)) {
return 0;
}
return fileTimeToRtsTime(userTime);
}
void
getUnixEpochTime(StgWord64 *sec, StgWord32 *nsec)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment