[Git][ghc/ghc][wip/eventlog-flush-interval] 3 commits: Revert haddock submodule yet again

Ben Gamari gitlab at gitlab.haskell.org
Wed Dec 16 17:36:58 UTC 2020



Ben Gamari pushed to branch wip/eventlog-flush-interval at Glasgow Haskell Compiler / GHC


Commits:
e9b18a75 by Ben Gamari at 2020-12-15T15:55:38-05:00
Revert haddock submodule yet again

- - - - -
b58cb63a by GHC GitLab CI at 2020-12-16T03:46:31+00:00
Bump haddock submodule

To adapt haddock for the nullary tyconapp optimisation patch.

- - - - -
70d6ea48 by Ben Gamari at 2020-12-16T12:36:51-05:00
rts: Introduce --eventlog-flush-interval flag

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.

- - - - -


5 changed files:

- docs/users_guide/runtime_control.rst
- includes/rts/Flags.h
- rts/RtsFlags.c
- rts/Timer.c
- utils/haddock


Changes:

=====================================
docs/users_guide/runtime_control.rst
=====================================
@@ -1238,6 +1238,15 @@ When the program is linked with the :ghc-flag:`-eventlog` option
     Sets the destination for the eventlog produced with the
     :rts-flag:`-l ⟨flags⟩` flag.
 
+.. rts-flag:: --eventlog-flush-interval=⟨seconds⟩
+
+    :default: disabled
+    :since: 9.2
+
+    When enabled, the eventlog will be flushed periodically every
+    ⟨seconds⟩. This can be useful in live-monitoring situations where the
+    eventlog is consumed in real-time by another process.
+
 .. rts-flag:: -v [⟨flags⟩]
 
     Log events as text to standard output, instead of to the


=====================================
includes/rts/Flags.h
=====================================
@@ -178,6 +178,8 @@ typedef struct _TRACE_FLAGS {
     bool sparks_full;    /* trace spark events 100% accurately */
     bool ticky;          /* trace ticky-ticky samples */
     bool user;           /* trace user events (emitted from Haskell code) */
+    Time eventlogFlushTime;  /* Time between force eventlog flushes (or 0 if disabled) */
+    int eventlogFlushTicks;
     char *trace_output;  /* output filename for eventlog */
 } TRACE_FLAGS;
 


=====================================
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"


=====================================
rts/Timer.c
=====================================
@@ -111,6 +111,14 @@ handle_tick(int unused STG_UNUSED)
       }
   }
 
+  if (eventlog_enabled && 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


=====================================
utils/haddock
=====================================
@@ -1 +1 @@
-Subproject commit 46c3db2460cea396fae525f4b9d8f40c34c0680e
+Subproject commit 059acb11d6134ee0d896bcf73c870958557a3909



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c5cd31ca07db7b1a97423333cdec00dcb6a249d4...70d6ea4832b8bc132f83c4a55ad983fb03add153

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c5cd31ca07db7b1a97423333cdec00dcb6a249d4...70d6ea4832b8bc132f83c4a55ad983fb03add153
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201216/310cc9cd/attachment-0001.html>


More information about the ghc-commits mailing list