summaryrefslogtreecommitdiff
path: root/rts/eventlog/EventLog.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/eventlog/EventLog.c')
-rw-r--r--rts/eventlog/EventLog.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index 88fc64010d..af87492876 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -254,12 +254,8 @@ initEventLogging(void)
#else
n_caps = 1;
#endif
- capEventBuf = stgMallocBytes(n_caps * sizeof(EventsBuf),"initEventLogging");
+ moreCapEventBufs(0,n_caps);
- for (c = 0; c < n_caps; ++c) {
- // Init buffer for events.
- initEventsBuf(&capEventBuf[c], EVENT_LOG_SIZE, c);
- }
initEventsBuf(&eventBuf, EVENT_LOG_SIZE, (EventCapNo)(-1));
// Write in buffer: the header begin marker.
@@ -417,7 +413,26 @@ endEventLogging(void)
}
}
-void
+void
+moreCapEventBufs (nat from, nat to)
+{
+ nat c;
+
+ if (from > 0) {
+ capEventBuf = stgReallocBytes(capEventBuf, to * sizeof(EventsBuf),
+ "moreCapEventBufs");
+ } else {
+ capEventBuf = stgMallocBytes(to * sizeof(EventsBuf),
+ "moreCapEventBufs");
+ }
+
+ for (c = from; c < to; ++c) {
+ initEventsBuf(&capEventBuf[c], EVENT_LOG_SIZE, c);
+ }
+}
+
+
+void
freeEventLogging(void)
{
StgWord8 c;