diff options
Diffstat (limited to 'rts/eventlog')
-rw-r--r-- | rts/eventlog/EventLog.c | 27 | ||||
-rw-r--r-- | rts/eventlog/EventLog.h | 1 |
2 files changed, 22 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; diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h index 667f34867d..1858be8ecd 100644 --- a/rts/eventlog/EventLog.h +++ b/rts/eventlog/EventLog.h @@ -26,6 +26,7 @@ void endEventLogging(void); void freeEventLogging(void); void abortEventLogging(void); // #4512 - after fork child needs to abort void flushEventLog(void); // event log inherited from parent +void moreCapEventBufs (nat from, nat to); /* * Post a scheduler event to the capability's event buffer (an event |