summaryrefslogtreecommitdiff
path: root/rts/Timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/Timer.c')
-rw-r--r--rts/Timer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rts/Timer.c b/rts/Timer.c
index 97d87ad989..d60d09e726 100644
--- a/rts/Timer.c
+++ b/rts/Timer.c
@@ -24,6 +24,7 @@
#include "Ticker.h"
#include "Capability.h"
#include "RtsSignals.h"
+#include "rts/EventLogWriter.h"
// This global counter is used to allow multiple threads to stop the
// timer temporarily with a stopTimer()/startTimer() pair. If
@@ -37,6 +38,9 @@ static StgWord timer_disabled;
/* ticks left before next pre-emptive context switch */
static int ticks_to_ctxt_switch = 0;
+/* ticks left before next next forced eventlog flush */
+static int ticks_to_eventlog_flush = 0;
+
/*
Note [GC During Idle Time]
@@ -111,6 +115,15 @@ handle_tick(int unused STG_UNUSED)
}
}
+ if (eventLogStatus() == EVENTLOG_RUNNING
+ && RtsFlags.TraceFlags.eventlogFlushTicks > 0) {
+ ticks_to_eventlog_flush--;
+ if (ticks_to_eventlog_flush <= 0) {
+ ticks_to_eventlog_flush = RtsFlags.TraceFlags.eventlogFlushTicks;
+ flushEventLog(NULL);
+ }
+ }
+
/*
* If we've been inactive for idleGCDelayTime (set by +RTS
* -I), tell the scheduler to wake up and do a GC, to check