diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsFlags.c | 19 | ||||
-rw-r--r-- | rts/Timer.c | 13 |
2 files changed, 32 insertions, 0 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index b23b19752b..7713c1a955 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -237,6 +237,7 @@ void initRtsFlagsDefaults(void) RtsFlags.TraceFlags.user = false; RtsFlags.TraceFlags.ticky = false; RtsFlags.TraceFlags.trace_output = NULL; + RtsFlags.TraceFlags.eventlogFlushTime = 0; #endif #if defined(PROFILING) @@ -977,6 +978,16 @@ error = true; printRtsInfo(rtsConfig); stg_exit(0); } + else if (strequal("eventlog-flush-interval=", + &rts_argv[arg][2])) { + OPTION_SAFE; + double intervalSeconds = parseDouble(rts_argv[arg]+26, &error); + if (error) { + errorBelch("bad value for --eventlog-flush-interval"); + } + RtsFlags.TraceFlags.eventlogFlushTime = + fsecondsToTime(intervalSeconds); + } else if (strequal("copying-gc", &rts_argv[arg][2])) { OPTION_SAFE; @@ -1799,6 +1810,14 @@ static void normaliseRtsOpts (void) RtsFlags.ProfFlags.heapProfileIntervalTicks = 0; } + if (RtsFlags.TraceFlags.eventlogFlushTime > 0) { + RtsFlags.TraceFlags.eventlogFlushTicks = + RtsFlags.TraceFlags.eventlogFlushTime / + RtsFlags.MiscFlags.tickInterval; + } else { + RtsFlags.TraceFlags.eventlogFlushTicks = 0; + } + if (RtsFlags.GcFlags.stkChunkBufferSize > RtsFlags.GcFlags.stkChunkSize / 2) { errorBelch("stack chunk buffer size (-kb) must be less than 50%%\n" 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 |