summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-21 21:22:01 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-17 05:48:01 -0500
commit66e281fba605dd650d7c2530ab8a482bb79538cb (patch)
tree56c7cb1a2420a0b890be50b648771afe8c184f0b
parent0ac5860ea4d45587771869970beecdd4da0cb105 (diff)
downloadhaskell-66e281fba605dd650d7c2530ab8a482bb79538cb.tar.gz
rts/eventlog: Introduce event to demarcate new ticky sample
-rw-r--r--docs/users_guide/eventlog-formats.rst7
-rw-r--r--includes/rts/EventLogFormat.h3
-rw-r--r--rts/eventlog/EventLog.c7
3 files changed, 16 insertions, 1 deletions
diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst
index a1a78f8476..3c274ceea9 100644
--- a/docs/users_guide/eventlog-formats.rst
+++ b/docs/users_guide/eventlog-formats.rst
@@ -868,6 +868,13 @@ entry counters to the eventlog.
Defines a ticky counter.
+.. event-type:: TICKY_COUNTER_BEGIN_SAMPLE
+
+ :tag: 212
+ :length: fixed
+
+ Denotes the beginning of an atomic set of ticky-ticky profiler counter samples.
+
.. event-type:: TICKY_COUNTER_SAMPLE
:tag: 211
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index d069ec6595..340a12d4e9 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -156,13 +156,14 @@
#define EVENT_TICKY_COUNTER_DEF 210
#define EVENT_TICKY_COUNTER_SAMPLE 211
+#define EVENT_TICKY_COUNTER_BEGIN_SAMPLE 212
/*
* The highest event code +1 that ghc itself emits. Note that some event
* 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 212
+#define NUM_GHC_EVENT_TAGS 213
#if 0 /* DEPRECATED EVENTS: */
/* we don't actually need to record the thread, it's implicit */
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index afd5a8171f..6c7d1e836c 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -122,6 +122,7 @@ char *EventDesc[] = {
[EVENT_CONC_UPD_REM_SET_FLUSH] = "Update remembered set flushed",
[EVENT_NONMOVING_HEAP_CENSUS] = "Nonmoving heap census",
[EVENT_TICKY_COUNTER_DEF] = "Ticky-ticky entry counter definition",
+ [EVENT_TICKY_COUNTER_BEGIN_SAMPLE] = "Ticky-ticky entry counter begin sample",
[EVENT_TICKY_COUNTER_SAMPLE] = "Ticky-ticky entry counter sample",
};
@@ -494,6 +495,10 @@ init_event_types(void)
eventTypes[t].size = EVENT_SIZE_DYNAMIC;
break;
+ case EVENT_TICKY_COUNTER_BEGIN_SAMPLE:
+ eventTypes[t].size = 0;
+ break;
+
case EVENT_TICKY_COUNTER_SAMPLE: // (counter_id, entry_count, allocs, allocd)
eventTypes[t].size = 8*4;
break;
@@ -1524,6 +1529,8 @@ static void postTickyCounterSample(EventsBuf *eb, StgEntCounter *p)
void postTickyCounterSamples(StgEntCounter *counters)
{
ACQUIRE_LOCK(&eventBufMutex);
+ ensureRoomForEvent(&eventBuf, EVENT_TICKY_COUNTER_SAMPLE);
+ postEventHeader(&eventBuf, EVENT_TICKY_COUNTER_BEGIN_SAMPLE);
for (StgEntCounter *p = counters; p != NULL; p = p->link) {
postTickyCounterSample(&eventBuf, p);
}