diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-12-16 12:21:46 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-12-16 13:51:01 -0500 |
commit | 02bc4b4f1a4fe07a46018738e7e12ec861aaf3df (patch) | |
tree | 4f289e9a4d3f608aeff18722787f67738f86e075 /rts/Timer.c | |
parent | b58cb63afd3353beb3a6e11ba7fa557fdedb8941 (diff) | |
download | haskell-wip/eventlog-flush-interval.tar.gz |
rts: Introduce --eventlog-flush-interval flagwip/eventlog-flush-interval
This introduces a flag, --eventlog-flush-interval, which can be used to
set an upper bound on the amount of time for which an eventlog event
will remain enqueued. This can be useful in real-time monitoring
settings.
Diffstat (limited to 'rts/Timer.c')
-rw-r--r-- | rts/Timer.c | 13 |
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 |