summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikolaj <mikolaj.konarski@gmail.com>2012-03-09 20:51:30 +0100
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:45 +0100
commitc294d95dc04950ab4c5380bf6ce8651f621f8591 (patch)
treef7af5643c634205fa9fc390c0dd4db7558b7f7e2
parent598109eb0cc2271c33e23b4ddb12123991273f61 (diff)
downloadhaskell-c294d95dc04950ab4c5380bf6ce8651f621f8591.tar.gz
Add the GC_GLOBAL_SYNC event marking that all caps are stopped for GC
Quoting design rationale by dcoutts: The event indicates that we're doing a stop-the-world GC and all other HECs should be between their GC_START and GC_END events at that moment. We don't want to use GC_STATS_GHC for that, because GC_STATS_GHC is for extra GHC-specific info, not something we have to rely on to be able to match the GC pauses across HECs to a particular global GC.
-rw-r--r--includes/rts/EventLogFormat.h5
-rw-r--r--rts/RtsProbes.d1
-rw-r--r--rts/Stats.c9
-rw-r--r--rts/Trace.c3
-rw-r--r--rts/Trace.h9
-rw-r--r--rts/eventlog/EventLog.c2
6 files changed, 26 insertions, 3 deletions
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index 667ed89eb1..b1933562da 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -157,8 +157,9 @@
copied_bytes, slop_bytes, frag_bytes,
par_n_threads,
par_max_copied, par_tot_copied) */
+#define EVENT_GC_GLOBAL_SYNC 54 /* () */
-/* Range 54 - 59 is available for new GHC and common events */
+/* Range 55 - 59 is available for new GHC and common events */
/* Range 60 - 80 is used by eden for parallel tracing
* see http://www.mathematik.uni-marburg.de/~eden/
@@ -171,7 +172,7 @@
* ranges higher than this are reserved but not currently emitted by ghc.
* This must match the size of the EventDesc[] array in EventLog.c
*/
-#define NUM_GHC_EVENT_TAGS 54
+#define NUM_GHC_EVENT_TAGS 55
#if 0 /* DEPRECATED EVENTS: */
/* we don't actually need to record the thread, it's implicit */
diff --git a/rts/RtsProbes.d b/rts/RtsProbes.d
index 8d24f3a9ca..f5470dfe0b 100644
--- a/rts/RtsProbes.d
+++ b/rts/RtsProbes.d
@@ -55,6 +55,7 @@ provider HaskellEvent {
probe gc__idle (EventCapNo);
probe gc__work (EventCapNo);
probe gc__done (EventCapNo);
+ probe gc__sync (EventCapNo);
probe gc__stats (CapsetID, StgWord, StgWord, StgWord, StgWord, StgWord, StgWord, StgWord);
probe heap__info (CapsetID, StgWord, StgWord, StgWord, StgWord, StgWord);
probe heap__allocated (EventCapNo, CapsetID, StgWord64);
diff --git a/rts/Stats.c b/rts/Stats.c
index ddc9bb96ae..cebb75343f 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -349,6 +349,13 @@ stat_endGC (Capability *cap, gc_thread *gct,
{
Time cpu, elapsed, gc_cpu, gc_elapsed;
+ // Has to be emitted while all caps stopped for GC, but before GC_END.
+ // See trac.haskell.org/ThreadScope/wiki/RTSsummaryEvents
+ // for a detailed design rationale of the current setup
+ // of GC eventlog events.
+ traceEventGcGlobalSync(cap);
+
+ // Emitted before GC_END on all caps, which simplifies tools code.
traceEventGcStats(cap,
CAPSET_HEAP_DEFAULT,
gen,
@@ -360,7 +367,7 @@ stat_endGC (Capability *cap, gc_thread *gct,
par_n_threads,
par_max_copied * sizeof(W_),
par_tot_copied * sizeof(W_));
-
+
getProcessTimes(&cpu, &elapsed);
// Post EVENT_GC_END with the same timestamp as used for stats
diff --git a/rts/Trace.c b/rts/Trace.c
index 995f8a2200..089bf24423 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -282,6 +282,9 @@ static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag)
case EVENT_GC_DONE: // (cap)
debugBelch("cap %d: GC done\n", cap->no);
break;
+ case EVENT_GC_GLOBAL_SYNC: // (cap)
+ debugBelch("cap %d: all caps stopped for GC\n", cap->no);
+ break;
default:
barf("traceGcEvent: unknown event tag %d", tag);
break;
diff --git a/rts/Trace.h b/rts/Trace.h
index 062666b503..c4c4e41608 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -350,6 +350,8 @@ INLINE_HEADER void dtraceStartup (int num_caps) {
HASKELLEVENT_GC_WORK(cap)
#define dtraceGcDone(cap) \
HASKELLEVENT_GC_DONE(cap)
+#define dtraceGcGlobalSync(cap) \
+ HASKELLEVENT_GC_GLOBAL_SYNC(cap)
#define dtraceEventGcStats(heap_capset, gens, \
copies, slop, fragmentation, \
par_n_threads, \
@@ -419,6 +421,7 @@ INLINE_HEADER void dtraceStartup (int num_caps STG_UNUSED) {};
#define dtraceGcIdle(cap) /* nothing */
#define dtraceGcWork(cap) /* nothing */
#define dtraceGcDone(cap) /* nothing */
+#define dtraceGcGlobalSync(cap) /* nothing */
#define dtraceEventGcStats(heap_capset, gens, \
copies, slop, fragmentation, \
par_n_threads, \
@@ -610,6 +613,12 @@ INLINE_HEADER void traceEventGcDone(Capability *cap STG_UNUSED)
dtraceGcDone((EventCapNo)cap->no);
}
+INLINE_HEADER void traceEventGcGlobalSync(Capability *cap STG_UNUSED)
+{
+ traceGcEvent(cap, EVENT_GC_GLOBAL_SYNC);
+ dtraceGcGlobalSync((EventCapNo)cap->no);
+}
+
INLINE_HEADER void traceEventGcStats(Capability *cap STG_UNUSED,
CapsetID heap_capset STG_UNUSED,
nat gen STG_UNUSED,
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index aab93bbd92..a3103775d9 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -71,6 +71,7 @@ char *EventDesc[] = {
[EVENT_GC_END] = "Finished GC",
[EVENT_REQUEST_SEQ_GC] = "Request sequential GC",
[EVENT_REQUEST_PAR_GC] = "Request parallel GC",
+ [EVENT_GC_GLOBAL_SYNC] = "Synchronise stop-the-world GC",
[EVENT_GC_STATS_GHC] = "GC statistics",
[EVENT_HEAP_INFO_GHC] = "Heap static parameters",
[EVENT_HEAP_ALLOCATED] = "Total heap mem ever allocated",
@@ -341,6 +342,7 @@ initEventLogging(void)
case EVENT_GC_IDLE:
case EVENT_GC_WORK:
case EVENT_GC_DONE:
+ case EVENT_GC_GLOBAL_SYNC: // (cap)
case EVENT_SPARK_CREATE: // (cap)
case EVENT_SPARK_DUD: // (cap)
case EVENT_SPARK_OVERFLOW: // (cap)