summaryrefslogtreecommitdiff
path: root/rts/Trace.h
diff options
context:
space:
mode:
authorMikolaj <mikolaj.konarski@gmail.com>2012-03-09 14:22:06 +0100
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:45 +0100
commit598109eb0cc2271c33e23b4ddb12123991273f61 (patch)
tree3399a0853bea39cd5ef5e66408ff949937446233 /rts/Trace.h
parent1f809ce6df1dca54b977c6cac8f2b1c745683cf9 (diff)
downloadhaskell-598109eb0cc2271c33e23b4ddb12123991273f61.tar.gz
Fix the timestamps in GC_START and GC_END events on the GC-initiating cap
There was a discrepancy between GC times reported in +RTS -s and the timestamps of GC_START and GC_END events on the cap, on which +RTS -s stats for the given GC are based. This is fixed by posting the events with exactly the same timestamp as generated for the stat calculation. The calls posting the events are moved too, so that the events are emitted close to the time instant they claim to be emitted at. The GC_STATS_GHC was moved, too, ensuring it's emitted before the moved GC_END on all caps, which simplifies tools code.
Diffstat (limited to 'rts/Trace.h')
-rw-r--r--rts/Trace.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/rts/Trace.h b/rts/Trace.h
index 18856d9721..062666b503 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -114,6 +114,16 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag,
void traceGcEvent_ (Capability *cap, EventTypeNum tag);
/*
+ * Record a GC event at the explicitly given timestamp
+ */
+#define traceGcEventAtT(cap, ts, tag) \
+ if (RTS_UNLIKELY(TRACE_gc)) { \
+ traceGcEventAtT_(cap, ts, tag); \
+ }
+
+void traceGcEventAtT_ (Capability *cap, StgWord64 ts, EventTypeNum tag);
+
+/*
* Record a heap event
*/
#define traceHeapEvent(cap, tag, heap_capset, info1) \
@@ -257,6 +267,7 @@ void traceSparkCounters_ (Capability *cap,
#define traceSchedEvent(cap, tag, tso, other) /* nothing */
#define traceSchedEvent2(cap, tag, tso, other, info) /* nothing */
#define traceGcEvent(cap, tag) /* nothing */
+#define traceGcEventAtT(cap, ts, tag) /* nothing */
#define traceEventGcStats_(cap, heap_capset, gen, \
copied, slop, fragmentation, \
par_n_threads, par_max_copied, par_tot_copied) /* nothing */
@@ -549,12 +560,26 @@ INLINE_HEADER void traceEventGcStart(Capability *cap STG_UNUSED)
dtraceGcStart((EventCapNo)cap->no);
}
+INLINE_HEADER void traceEventGcStartAtT(Capability *cap STG_UNUSED,
+ StgWord64 ts STG_UNUSED)
+{
+ traceGcEventAtT(cap, ts, EVENT_GC_START);
+ dtraceGcStart((EventCapNo)cap->no);
+}
+
INLINE_HEADER void traceEventGcEnd(Capability *cap STG_UNUSED)
{
traceGcEvent(cap, EVENT_GC_END);
dtraceGcEnd((EventCapNo)cap->no);
}
+INLINE_HEADER void traceEventGcEndAtT(Capability *cap STG_UNUSED,
+ StgWord64 ts STG_UNUSED)
+{
+ traceGcEventAtT(cap, ts, EVENT_GC_END);
+ dtraceGcEnd((EventCapNo)cap->no);
+}
+
INLINE_HEADER void traceEventRequestSeqGc(Capability *cap STG_UNUSED)
{
traceGcEvent(cap, EVENT_REQUEST_SEQ_GC);