Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • docs/users_guide/runtime_control.rst
    ... ... @@ -1361,7 +1361,8 @@ When the program is linked with the :ghc-flag:`-eventlog` option
    1361 1361
         :since: 9.2
    
    1362 1362
     
    
    1363 1363
         When enabled, the eventlog will be flushed periodically every
    
    1364
    -    ⟨seconds⟩. This can be useful in live-monitoring situations where the
    
    1364
    +    ⟨seconds⟩ (only available with :ghc-flag:`-threaded`).
    
    1365
    +    This can be useful in live-monitoring situations where the
    
    1365 1366
         eventlog is consumed in real-time by another process.
    
    1366 1367
     
    
    1367 1368
     .. rts-flag:: -v [⟨flags⟩]
    

  • rts/RtsFlags.c
    ... ... @@ -248,7 +248,9 @@ void initRtsFlagsDefaults(void)
    248 248
         RtsFlags.TraceFlags.user          = false;
    
    249 249
         RtsFlags.TraceFlags.ticky         = false;
    
    250 250
         RtsFlags.TraceFlags.trace_output  = NULL;
    
    251
    +#  if defined(THREADED_RTS)
    
    251 252
         RtsFlags.TraceFlags.eventlogFlushTime = 0;
    
    253
    +#  endif
    
    252 254
         RtsFlags.TraceFlags.nullWriter = false;
    
    253 255
     #endif
    
    254 256
     
    
    ... ... @@ -448,8 +450,10 @@ usage_text[] = {
    448 450
     #  endif
    
    449 451
     "               -x    disable an event class, for any flag above",
    
    450 452
     "             the initial enabled event classes are 'sgpu'",
    
    453
    +#  if defined(THREADED_RTS)
    
    451 454
     " --eventlog-flush-interval=<secs>",
    
    452 455
     "             Periodically flush the eventlog at the specified interval.",
    
    456
    +#  endif
    
    453 457
     #endif
    
    454 458
     
    
    455 459
     "",
    
    ... ... @@ -1052,12 +1056,14 @@ error = true;
    1052 1056
                       else if (!strncmp("eventlog-flush-interval=",
    
    1053 1057
                                    &rts_argv[arg][2], 24)) {
    
    1054 1058
                           OPTION_SAFE;
    
    1059
    +                      THREADED_BUILD_ONLY(
    
    1055 1060
                           double intervalSeconds = parseDouble(rts_argv[arg]+26, &error);
    
    1056 1061
                           if (error) {
    
    1057 1062
                               errorBelch("bad value for --eventlog-flush-interval");
    
    1058 1063
                           }
    
    1059 1064
                           RtsFlags.TraceFlags.eventlogFlushTime =
    
    1060 1065
                               fsecondsToTime(intervalSeconds);
    
    1066
    +                      ) break;
    
    1061 1067
                       }
    
    1062 1068
                       else if (strequal("copying-gc",
    
    1063 1069
                                    &rts_argv[arg][2])) {
    
    ... ... @@ -1963,6 +1969,7 @@ static void normaliseRtsOpts (void)
    1963 1969
             RtsFlags.ProfFlags.heapProfileIntervalTicks = 0;
    
    1964 1970
         }
    
    1965 1971
     
    
    1972
    +#if defined(THREADED_RTS)
    
    1966 1973
         if (RtsFlags.TraceFlags.eventlogFlushTime > 0 && RtsFlags.MiscFlags.tickInterval != 0) {
    
    1967 1974
             RtsFlags.TraceFlags.eventlogFlushTicks =
    
    1968 1975
                 RtsFlags.TraceFlags.eventlogFlushTime /
    
    ... ... @@ -1970,6 +1977,7 @@ static void normaliseRtsOpts (void)
    1970 1977
         } else {
    
    1971 1978
             RtsFlags.TraceFlags.eventlogFlushTicks = 0;
    
    1972 1979
         }
    
    1980
    +#endif
    
    1973 1981
     
    
    1974 1982
         if (RtsFlags.GcFlags.stkChunkBufferSize >
    
    1975 1983
             RtsFlags.GcFlags.stkChunkSize / 2) {
    

  • rts/Timer.c
    ... ... @@ -43,8 +43,10 @@ static StgWord timer_disabled;
    43 43
     /* ticks left before next pre-emptive context switch */
    
    44 44
     static int ticks_to_ctxt_switch = 0;
    
    45 45
     
    
    46
    +#if defined(THREADED_RTS)
    
    46 47
     /* ticks left before next next forced eventlog flush */
    
    47 48
     static int ticks_to_eventlog_flush = 0;
    
    49
    +#endif
    
    48 50
     
    
    49 51
     
    
    50 52
     /*
    
    ... ... @@ -118,7 +120,7 @@ handle_tick(int unused STG_UNUSED)
    118 120
               contextSwitchAllCapabilities(); /* schedule a context switch */
    
    119 121
           }
    
    120 122
       }
    
    121
    -
    
    123
    +#if defined(THREADED_RTS)
    
    122 124
       if (eventLogStatus() == EVENTLOG_RUNNING
    
    123 125
           && RtsFlags.TraceFlags.eventlogFlushTicks > 0) {
    
    124 126
           ticks_to_eventlog_flush--;
    
    ... ... @@ -127,6 +129,7 @@ handle_tick(int unused STG_UNUSED)
    127 129
               flushEventLog(NULL);
    
    128 130
           }
    
    129 131
       }
    
    132
    +#endif
    
    130 133
     
    
    131 134
       /*
    
    132 135
        * If we've been inactive for idleGCDelayTime (set by +RTS
    

  • rts/include/rts/Flags.h
    ... ... @@ -188,8 +188,11 @@ typedef struct _TRACE_FLAGS {
    188 188
         bool sparks_full;    /* trace spark events 100% accurately */
    
    189 189
         bool ticky;          /* trace ticky-ticky samples */
    
    190 190
         bool user;           /* trace user events (emitted from Haskell code) */
    
    191
    -    Time eventlogFlushTime;  /* Time between force eventlog flushes (or 0 if disabled) */
    
    191
    +#if defined(THREADED_RTS)
    
    192
    +    /* Time between force eventlog flushes (or 0 if disabled) */
    
    193
    +    Time eventlogFlushTime;
    
    192 194
         int eventlogFlushTicks;
    
    195
    +#endif
    
    193 196
         char *trace_output;  /* output filename for eventlog */
    
    194 197
         bool nullWriter; /* use null writer instead of file writer */
    
    195 198
     } TRACE_FLAGS;
    

  • testsuite/tests/rts/flags/all.T
    ... ... @@ -57,6 +57,14 @@ test('T12870h',
    57 57
         multimod_compile_and_run,
    
    58 58
         ['T12870g', '-rtsopts=ignoreAll -with-rtsopts="-G3"'])
    
    59 59
     
    
    60
    -test('T20006', [extra_run_opts('+RTS --eventlog-flush-interval=1')],
    
    61
    -    compile_and_run,
    
    62
    -    [''])
    60
    +test('T20006a',
    
    61
    +    [extra_files(['T20006.hs']), extra_run_opts('+RTS --eventlog-flush-interval=1'),
    
    62
    +        only_ways(['threaded1', 'threaded2'])],
    
    63
    +    multimod_compile_and_run,
    
    64
    +    ['T20006', ''])
    
    65
    +
    
    66
    +test('T20006b',
    
    67
    +    [extra_files(['T20006.hs']), extra_run_opts('+RTS --eventlog-flush-interval=1'),
    
    68
    +        expect_fail_for(['normal'])],
    
    69
    +    multimod_compile_and_run,
    
    70
    +    ['T20006', ''])