[commit: ghc] ghc-8.6: rts: Flush eventlog in hs_init_ghc (fixes #15440) (50e4e48)

git at git.haskell.org git at git.haskell.org
Mon Jul 30 22:26:55 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/50e4e48bb0d63aaa4c62f5ca0f01d5fb7587ec84/ghc

>---------------------------------------------------------------

commit 50e4e48bb0d63aaa4c62f5ca0f01d5fb7587ec84
Author: Mitsutoshi Aoe <maoe at foldr.in>
Date:   Thu Jul 26 14:50:51 2018 +0900

    rts: Flush eventlog in hs_init_ghc (fixes #15440)
    
    Without this change RTS typically doesn't flush some important
    events until the process terminates or it doesn't write them at
    all in case it terminates abnormally.
    
    Here is a list of such events:
    
    * EVENT_WALL_CLOCK_TIME
    * EVENT_OS_PROCESS_PID
    * EVENT_OS_PROCESS_PPID
    * EVENT_RTS_IDENTIFIER
    * EVENT_PROGRAM_ARGS
    * EVENT_PROGRAM_ENV
    
    (cherry picked from commit 7a3e1b25ff9a570851a59c4cf3600daa49867b9b)


>---------------------------------------------------------------

50e4e48bb0d63aaa4c62f5ca0f01d5fb7587ec84
 rts/RtsStartup.c | 1 +
 rts/Trace.c      | 7 +++++++
 rts/Trace.h      | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 7eb98a8..0cb1ff9 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -237,6 +237,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
     /* Trace some basic information about the process */
     traceWallClockTime();
     traceOSProcessInfo();
+    flushTrace();
 
     /* initialize the storage manager */
     initStorage();
diff --git a/rts/Trace.c b/rts/Trace.c
index 71403f8..02c177f 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -130,6 +130,13 @@ void resetTracing (void)
     }
 }
 
+void flushTrace (void)
+{
+    if (eventlog_enabled) {
+        flushEventLog();
+    }
+}
+
 void tracingAddCapapilities (uint32_t from, uint32_t to)
 {
     if (eventlog_enabled) {
diff --git a/rts/Trace.h b/rts/Trace.h
index a72248a..d53e92c 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -295,6 +295,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id,
                                    CostCentreStack *stack, StgWord residency);
 #endif /* PROFILING */
 
+void flushTrace(void);
+
 #else /* !TRACING */
 
 #define traceSchedEvent(cap, tag, tso, other) /* nothing */
@@ -331,6 +333,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id,
 #define traceHeapProfSampleCostCentre(profile_id, stack, residency) /* nothing */
 #define traceHeapProfSampleString(profile_id, label, residency) /* nothing */
 
+#define flushTrace() /* nothing */
+
 #endif /* TRACING */
 
 // If DTRACE is enabled, but neither DEBUG nor TRACING, we need a C land



More information about the ghc-commits mailing list