Commit e5c5f612 authored by Ben Gamari's avatar Ben Gamari 🐢

Fix it

parent 074cfe0e
......@@ -33,6 +33,7 @@ typedef int64_t Time;
#define SecondsToTime(t) ((Time)(t) * TIME_RESOLUTION)
#define TimeToSeconds(t) ((t) / TIME_RESOLUTION)
#define TimeToSecondsDbl(t) ((double)(t) / TIME_RESOLUTION)
// Use instead of SecondsToTime() when we have a floating-point
// seconds value, to avoid truncating it.
......
......@@ -1179,6 +1179,8 @@ heapCensusChain( Census *census, bdescr *bd )
}
}
// Time is process CPU time of beginning of current GC and is used as
// the mutator CPU time reported as the census timestamp.
void heapCensus (Time t)
{
uint32_t g, n;
......@@ -1186,7 +1188,7 @@ void heapCensus (Time t)
gen_workspace *ws;
census = &censuses[era];
census->time = mut_user_time_until(t);
census->time = TimeToSecondsDbl(t);
census->rtime = TimeToNS(stat_getElapsedTime());
......
......@@ -26,8 +26,6 @@
#include <string.h> // for memset
#define TimeToSecondsDbl(t) ((double)(t) / TIME_RESOLUTION)
static Time
start_init_cpu, start_init_elapsed,
end_init_cpu, end_init_elapsed,
......
......@@ -207,6 +207,14 @@ GarbageCollect (uint32_t collect_gen,
gc_thread *saved_gct;
#endif
uint32_t g, n;
// the time we should report our heap census as occurring at, if necessary.
Time mut_time = 0;
if (do_heap_census) {
RTSStats stats;
getRTSStats(&stats);
mut_time = stats.mutator_cpu_ns;
}
// necessary if we stole a callee-saves register for gct:
#if defined(THREADED_RTS)
......@@ -813,7 +821,7 @@ GarbageCollect (uint32_t collect_gen,
if (do_heap_census) {
debugTrace(DEBUG_sched, "performing heap census");
RELEASE_SM_LOCK;
heapCensus(gct->gc_start_cpu);
heapCensus(mut_time);
ACQUIRE_SM_LOCK;
}
......
......@@ -188,8 +188,8 @@ typedef struct gc_thread_ {
Time gc_start_cpu; // thread CPU time
Time gc_end_cpu; // thread CPU time
Time gc_sync_start_elapsed; // start of GC sync
Time gc_start_elapsed; // thread elapsed time
Time gc_end_elapsed;
Time gc_start_elapsed; // process elapsed time
Time gc_end_elapsed; // process elapsed 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