summaryrefslogtreecommitdiff
path: root/rts/eventlog
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2011-06-06 10:39:16 +0100
committerDuncan Coutts <duncan@well-typed.com>2011-07-18 16:31:14 +0100
commitd77df1caad3a5f833aac9275938a0675e1ee6aac (patch)
tree611e7bb5cb902a0bc0987f541627d565c4563c0a /rts/eventlog
parent5d091088ce94be4c389fa669911d0e842bd08952 (diff)
downloadhaskell-d77df1caad3a5f833aac9275938a0675e1ee6aac.tar.gz
Add spark counter tracing
A new eventlog event containing 7 spark counters/statistics: sparks created, dud, overflowed, converted, GC'd, fizzled and remaining. These are maintained and logged separately for each capability. We log them at startup, on each GC (minor and major) and on shutdown.
Diffstat (limited to 'rts/eventlog')
-rw-r--r--rts/eventlog/EventLog.c31
-rw-r--r--rts/eventlog/EventLog.h7
2 files changed, 37 insertions, 1 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index cea313e660..1e63a94c88 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -84,7 +84,8 @@ char *EventDesc[] = {
[EVENT_PROGRAM_ARGS] = "Program arguments",
[EVENT_PROGRAM_ENV] = "Program environment variables",
[EVENT_OSPROCESS_PID] = "Process ID",
- [EVENT_OSPROCESS_PPID] = "Parent process ID"
+ [EVENT_OSPROCESS_PPID] = "Parent process ID",
+ [EVENT_SPARK_COUNTERS] = "Spark counters"
};
// Event type.
@@ -314,6 +315,10 @@ initEventLogging(void)
eventTypes[t].size = 0xffff;
break;
+ case EVENT_SPARK_COUNTERS: // (cap, 7*counter)
+ eventTypes[t].size = 7 * sizeof(StgWord64);
+ break;
+
case EVENT_BLOCK_MARKER:
eventTypes[t].size = sizeof(StgWord32) + sizeof(EventTimestamp) +
sizeof(EventCapNo);
@@ -478,6 +483,30 @@ postSchedEvent (Capability *cap,
}
}
+void
+postSparkCountersEvent (Capability *cap,
+ SparkCounters counters,
+ StgWord remaining)
+{
+ EventsBuf *eb;
+
+ eb = &capEventBuf[cap->no];
+
+ if (!hasRoomForEvent(eb, EVENT_SPARK_COUNTERS)) {
+ // Flush event buffer to make room for new event.
+ printAndClearEventBuf(eb);
+ }
+
+ postEventHeader(eb, EVENT_SPARK_COUNTERS);
+ postWord64(eb,counters.created);
+ postWord64(eb,counters.dud);
+ postWord64(eb,counters.overflowed);
+ postWord64(eb,counters.converted);
+ postWord64(eb,counters.gcd);
+ postWord64(eb,counters.fizzled);
+ postWord64(eb,remaining);
+}
+
void postCapsetModifyEvent (EventTypeNum tag,
EventCapsetID capset,
StgWord32 other)
diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h
index 602ac2c87b..431292732f 100644
--- a/rts/eventlog/EventLog.h
+++ b/rts/eventlog/EventLog.h
@@ -69,6 +69,13 @@ void postCapsetVecEvent (EventTypeNum tag,
int argc,
char *msg[]);
+/*
+ * Post an event with several counters relating to `par` sparks.
+ */
+void postSparkCountersEvent (Capability *cap,
+ SparkCounters counters,
+ StgWord remaining);
+
#else /* !TRACING */
INLINE_HEADER void postSchedEvent (Capability *cap STG_UNUSED,