Commit 7a3e1b25 authored by Mitsutoshi Aoe's avatar Mitsutoshi Aoe Committed by Ben Gamari

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
parent 890f6468
...@@ -237,6 +237,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) ...@@ -237,6 +237,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
/* Trace some basic information about the process */ /* Trace some basic information about the process */
traceWallClockTime(); traceWallClockTime();
traceOSProcessInfo(); traceOSProcessInfo();
flushTrace();
/* initialize the storage manager */ /* initialize the storage manager */
initStorage(); initStorage();
......
...@@ -130,6 +130,13 @@ void resetTracing (void) ...@@ -130,6 +130,13 @@ void resetTracing (void)
} }
} }
void flushTrace (void)
{
if (eventlog_enabled) {
flushEventLog();
}
}
void tracingAddCapapilities (uint32_t from, uint32_t to) void tracingAddCapapilities (uint32_t from, uint32_t to)
{ {
if (eventlog_enabled) { if (eventlog_enabled) {
......
...@@ -295,6 +295,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id, ...@@ -295,6 +295,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id,
CostCentreStack *stack, StgWord residency); CostCentreStack *stack, StgWord residency);
#endif /* PROFILING */ #endif /* PROFILING */
void flushTrace(void);
#else /* !TRACING */ #else /* !TRACING */
#define traceSchedEvent(cap, tag, tso, other) /* nothing */ #define traceSchedEvent(cap, tag, tso, other) /* nothing */
...@@ -331,6 +333,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id, ...@@ -331,6 +333,8 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id,
#define traceHeapProfSampleCostCentre(profile_id, stack, residency) /* nothing */ #define traceHeapProfSampleCostCentre(profile_id, stack, residency) /* nothing */
#define traceHeapProfSampleString(profile_id, label, residency) /* nothing */ #define traceHeapProfSampleString(profile_id, label, residency) /* nothing */
#define flushTrace() /* nothing */
#endif /* TRACING */ #endif /* TRACING */
// If DTRACE is enabled, but neither DEBUG nor TRACING, we need a C land // If DTRACE is enabled, but neither DEBUG nor TRACING, we need a C land
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment