[commit: ghc] master: rts: drop unused getThreadCPUTime (256c1b3)
git at git.haskell.org
git at git.haskell.org
Sun Feb 7 20:28:20 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/256c1b3922ffed686e80c051d3d59ed8581993be/ghc
>---------------------------------------------------------------
commit 256c1b3922ffed686e80c051d3d59ed8581993be
Author: Sergei Trofimovich <siarheit at google.com>
Date: Sun Feb 7 16:59:03 2016 +0000
rts: drop unused getThreadCPUTime
Use of this helper function was removed in:
commit 3c9fc104337a142fe4f375d30d7a6b81d55a70c1
Author: Brian Brooks <brooks.brian at 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: Sergei Trofimovich <siarheit at google.com>
>---------------------------------------------------------------
256c1b3922ffed686e80c051d3d59ed8581993be
rts/GetTime.h | 1 -
rts/posix/GetTime.c | 30 ------------------------------
rts/win32/GetTime.c | 13 -------------
3 files changed, 44 deletions(-)
diff --git a/rts/GetTime.h b/rts/GetTime.h
index 32c3754..4aaddd0 100644
--- a/rts/GetTime.h
+++ b/rts/GetTime.h
@@ -14,7 +14,6 @@
void initializeTimer (void);
Time getProcessCPUTime (void);
-Time getThreadCPUTime (void);
Time getProcessElapsedTime (void);
void getProcessTimes (Time *user, Time *elapsed);
diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c
index def78a4..24d0d50 100644
--- a/rts/posix/GetTime.c
+++ b/rts/posix/GetTime.c
@@ -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)
diff --git a/rts/win32/GetTime.c b/rts/win32/GetTime.c
index 3600839..6a45248 100644
--- a/rts/win32/GetTime.c
+++ b/rts/win32/GetTime.c
@@ -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)
{
More information about the ghc-commits
mailing list