Commit 3c9fc104 authored by brbr's avatar brbr Committed by Austin Seipp

Avoid unnecessary clock_gettime() syscalls in GC stats.

Summary: Avoid unnecessary clock_gettime() syscalls in GC stats.

Test Plan: Use strace.

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: simonmar, relrod, carter

Differential Revision: https://phabricator.haskell.org/D39
parent 61cce911
......@@ -173,8 +173,8 @@ initStats1 (void)
nat i;
if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
statsPrintf(" Alloc Copied Live GC GC TOT TOT Page Flts\n");
statsPrintf(" bytes bytes bytes user elap user elap\n");
statsPrintf(" Alloc Copied Live GC GC TOT TOT Page Flts\n");
statsPrintf(" bytes bytes bytes user elap user elap\n");
}
GC_coll_cpu =
(Time *)stgMallocBytes(
......@@ -287,53 +287,12 @@ stat_startGC (Capability *cap, gc_thread *gct)
traceEventGcStartAtT(cap,
TimeToNS(gct->gc_start_elapsed - start_init_elapsed));
gct->gc_start_thread_cpu = getThreadCPUTime();
if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
{
gct->gc_start_faults = getPageFaults();
}
}
void
stat_gcWorkerThreadStart (gc_thread *gct STG_UNUSED)
{
#if 0
/*
* We dont' collect per-thread GC stats any more, but this code
* could be used to do that if we want to in the future:
*/
if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
{
getProcessTimes(&gct->gc_start_cpu, &gct->gc_start_elapsed);
gct->gc_start_thread_cpu = getThreadCPUTime();
}
#endif
}
void
stat_gcWorkerThreadDone (gc_thread *gct STG_UNUSED)
{
#if 0
/*
* We dont' collect per-thread GC stats any more, but this code
* could be used to do that if we want to in the future:
*/
Time thread_cpu, elapsed, gc_cpu, gc_elapsed;
if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
{
elapsed = getProcessElapsedTime();
thread_cpu = getThreadCPUTime();
gc_cpu = thread_cpu - gct->gc_start_thread_cpu;
gc_elapsed = elapsed - gct->gc_start_elapsed;
taskDoneGC(gct->cap->running_task, gc_cpu, gc_elapsed);
}
#endif
}
/* -----------------------------------------------------------------------------
* Calculate the total allocated memory since the start of the
* program. Also emits events reporting the per-cap allocation
......
......@@ -32,9 +32,6 @@ void stat_endGC (Capability *cap, struct gc_thread_ *_gct,
W_ live, W_ copied, W_ slop, nat gen,
nat n_gc_threads, W_ par_max_copied, W_ par_tot_copied);
void stat_gcWorkerThreadStart (struct gc_thread_ *_gct);
void stat_gcWorkerThreadDone (struct gc_thread_ *_gct);
#ifdef PROFILING
void stat_startRP(void);
void stat_endRP(nat,
......
......@@ -1041,8 +1041,6 @@ gcWorkerThread (Capability *cap)
SET_GCT(gc_threads[cap->no]);
gct->id = osThreadId();
stat_gcWorkerThreadStart(gct);
// Wait until we're told to wake up
RELEASE_SPIN_LOCK(&gct->mut_spin);
// yieldThread();
......@@ -1100,9 +1098,6 @@ gcWorkerThread (Capability *cap)
ACQUIRE_SPIN_LOCK(&gct->mut_spin);
debugTrace(DEBUG_gc, "GC thread %d on my way...", gct->thread_index);
// record the time spent doing GC in the Task structure
stat_gcWorkerThreadDone(gct);
SET_GCT(saved_gct);
}
......
......@@ -77,7 +77,7 @@
------------------------------------------------------------------------- */
typedef struct gen_workspace_ {
generation * gen; // the gen for this workspace
generation * gen; // the gen for this workspace
struct gc_thread_ * my_gct; // the gc_thread that contains this workspace
// where objects to be scavenged go
......@@ -184,7 +184,6 @@ typedef struct gc_thread_ {
Time gc_start_cpu; // process CPU time
Time gc_start_elapsed; // process elapsed time
Time gc_start_thread_cpu; // thread CPU time
W_ gc_start_faults;
// -------------------
......
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