X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsFlags.c;h=1403801b07fc2814628d1114988708ca6a9191d6;hb=6cf8982ac30be6836a0cdd8be5a6ac1a1a144213;hp=856137119c2d9e5d07dc6811862de390f5d9a423;hpb=dd56e9ab4544e83d27532a8d9058140bfe81825c;p=ghc-hetmet.git diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 8561371..1403801 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -9,7 +9,7 @@ #include "PosixSource.h" #include "Rts.h" -#include "RtsFlags.h" + #include "RtsUtils.h" #include "Profiling.h" @@ -17,7 +17,6 @@ #include #endif -#include #include // Flag Structure @@ -107,12 +106,11 @@ void initRtsFlagsDefaults(void) RtsFlags.DebugFlags.stable = rtsFalse; RtsFlags.DebugFlags.stm = rtsFalse; RtsFlags.DebugFlags.prof = rtsFalse; - RtsFlags.DebugFlags.eventlog = rtsFalse; RtsFlags.DebugFlags.apply = rtsFalse; RtsFlags.DebugFlags.linker = rtsFalse; RtsFlags.DebugFlags.squeeze = rtsFalse; RtsFlags.DebugFlags.hpc = rtsFalse; - RtsFlags.DebugFlags.timestamp = rtsFalse; + RtsFlags.DebugFlags.sparks = rtsFalse; #endif #if defined(PROFILING) @@ -136,8 +134,10 @@ void initRtsFlagsDefaults(void) RtsFlags.ProfFlags.bioSelector = NULL; #endif -#ifdef EVENTLOG - RtsFlags.EventLogFlags.doEventLogging = rtsFalse; +#ifdef TRACING + RtsFlags.TraceFlags.tracing = TRACE_NONE; + RtsFlags.TraceFlags.timestamp = rtsFalse; + RtsFlags.TraceFlags.scheduler = rtsFalse; #endif RtsFlags.MiscFlags.tickInterval = 20; /* In milliseconds */ @@ -152,8 +152,9 @@ void initRtsFlagsDefaults(void) RtsFlags.ParFlags.migrate = rtsTrue; RtsFlags.ParFlags.wakeupMigrate = rtsFalse; RtsFlags.ParFlags.parGcEnabled = 1; - RtsFlags.ParFlags.parGcGen = 1; - RtsFlags.ParFlags.parGcLoadBalancing = 1; + RtsFlags.ParFlags.parGcGen = 0; + RtsFlags.ParFlags.parGcLoadBalancingEnabled = rtsTrue; + RtsFlags.ParFlags.parGcLoadBalancingGen = 1; RtsFlags.ParFlags.setAffinity = 0; #endif @@ -197,9 +198,11 @@ usage_text[] = { " -m Minimum % of heap which must be available (default 3%)", " -G Number of generations (default: 2)", " -T Number of steps in younger generations (default: 2)", -" -c Auto-enable compaction of the oldest generation when live data is", -" at least % of the maximum heap size set with -M (default: 30%)", -" -c Enable compaction for all major collections", +" -c Use in-place compaction instead of copying in the oldest generation", +" when live data is at least % of the maximum heap size set with", +" -M (default: 30%)", +" -c Use in-place compaction for all oldest generation collections", +" (the default is to use copying)", " -w Use mark-region for the oldest generation (experimental)", #if defined(THREADED_RTS) " -I Perform full GC after idle time (default: 0.3, 0 == off)", @@ -253,9 +256,13 @@ usage_text[] = { # endif #endif /* PROFILING or PAR */ -#ifdef EVENTLOG +#ifdef TRACING +"", +" -v Log events to stderr", +" -l Log events in binary format to the file .eventlog", +" -vt Include time stamps when tracing events to stderr with -v", "", -" -l Log runtime events (generates binary trace file .eventlog)", +" -ls Log scheduler events", "", #endif @@ -276,8 +283,6 @@ usage_text[] = { " This sets the resolution for -C and the profile timer -i.", " Default: 0.02 sec.", "", -" -vt Time-stamp debug messages", -"", #if defined(DEBUG) " -Ds DEBUG: scheduler", " -Di DEBUG: interpreter", @@ -294,15 +299,20 @@ usage_text[] = { " -Dm DEBUG: stm", " -Dz DEBUG: stack squezing", " -Dc DEBUG: program coverage", +" -Dr DEBUG: sparks", +"", +" NOTE: all -D options also enable -v automatically. Use -l to create a", +" binary event log file instead.", "", #endif /* DEBUG */ #if defined(THREADED_RTS) && !defined(NOSMP) " -N Use processors (default: 1)", " -N Determine the number of processors to use automatically", -" -q1 Use one OS thread for GC (turns off parallel GC)", -" -qg Use parallel GC only for generations >= (default: 1)", -" -qb Disable load-balancing in the parallel GC", -" -qa Use the OS to set thread affinity", +" -qg[] Use parallel GC only for generations >= ", +" (default: 0, -qg alone turns off parallel GC)", +" -qb[] Use load-balancing in the parallel GC only for generations >= ", +" (default: 1, -qb alone turns off load-balancing)", +" -qa Use the OS to set thread affinity (experimental)", " -qm Don't automatically migrate threads between CPUs", " -qw Migrate a thread to the current CPU when it is woken up", #endif @@ -473,10 +483,10 @@ errorBelch("not built for: -prof"); \ error = rtsTrue; #endif -#ifdef EVENTLOG -# define EVENTLOG_BUILD_ONLY(x) x +#ifdef TRACING +# define TRACING_BUILD_ONLY(x) x #else -# define EVENTLOG_BUILD_ONLY(x) \ +# define TRACING_BUILD_ONLY(x) \ errorBelch("not built for: -par-prof"); \ error = rtsTrue; #endif @@ -618,9 +628,6 @@ error = rtsTrue; case 'p': RtsFlags.DebugFlags.prof = rtsTrue; break; - case 'e': - RtsFlags.DebugFlags.eventlog = rtsTrue; - break; case 'l': RtsFlags.DebugFlags.linker = rtsTrue; break; @@ -636,10 +643,16 @@ error = rtsTrue; case 'c': RtsFlags.DebugFlags.hpc = rtsTrue; break; + case 'r': + RtsFlags.DebugFlags.sparks = rtsTrue; + break; default: bad_option( rts_argv[arg] ); } } + // -Dx also turns on -v. Use -l to direct trace + // events to the .eventlog file instead. + RtsFlags.TraceFlags.tracing = TRACE_STDERR; break; } #endif @@ -744,12 +757,24 @@ error = rtsTrue; /* =========== PROFILING ========================== */ case 'l': -#ifdef EVENTLOG - RtsFlags.EventLogFlags.doEventLogging = rtsTrue; +#ifdef TRACING + switch(rts_argv[arg][2]) { + case '\0': + RtsFlags.TraceFlags.tracing = TRACE_EVENTLOG; + break; + case 's': + RtsFlags.TraceFlags.tracing = TRACE_EVENTLOG; + RtsFlags.TraceFlags.scheduler = rtsTrue; + break; + default: + errorBelch("unknown RTS option: %s",rts_argv[arg]); + error = rtsTrue; + break; + } #else - errorBelch("not built for: -eventlog"); + errorBelch("not built for: -eventlog"); #endif - break; + break; case 'P': /* detailed cost centre profiling (time/alloc) */ case 'p': /* cost centre profiling (time/alloc) */ @@ -986,21 +1011,25 @@ error = rtsTrue; errorBelch("incomplete RTS option: %s",rts_argv[arg]); error = rtsTrue; break; - case '1': - RtsFlags.ParFlags.parGcEnabled = rtsFalse; - break; case 'g': - if (rts_argv[arg][3] != '\0') { + if (rts_argv[arg][3] == '\0') { + RtsFlags.ParFlags.parGcEnabled = rtsFalse; + } else { + RtsFlags.ParFlags.parGcEnabled = rtsTrue; RtsFlags.ParFlags.parGcGen = strtol(rts_argv[arg]+3, (char **) NULL, 10); - } else { - errorBelch("bad value for -qg"); - error = rtsTrue; } break; case 'b': - RtsFlags.ParFlags.parGcLoadBalancing = rtsFalse; - break; + if (rts_argv[arg][3] == '\0') { + RtsFlags.ParFlags.parGcLoadBalancingEnabled = rtsFalse; + } + else { + RtsFlags.ParFlags.parGcLoadBalancingEnabled = rtsTrue; + RtsFlags.ParFlags.parGcLoadBalancingGen + = strtol(rts_argv[arg]+3, (char **) NULL, 10); + } + break; case 'a': RtsFlags.ParFlags.setAffinity = rtsTrue; break; @@ -1050,13 +1079,14 @@ error = rtsTrue; case 'v': switch(rts_argv[arg][2]) { - case '\0': - errorBelch("incomplete RTS option: %s",rts_argv[arg]); - error = rtsTrue; - break; +#ifdef TRACING + case '\0': + RtsFlags.TraceFlags.tracing = TRACE_STDERR; + break; case 't': - RtsFlags.DebugFlags.timestamp = rtsTrue; + RtsFlags.TraceFlags.timestamp = rtsTrue; break; +#endif case 's': case 'g': // ignored for backwards-compat @@ -1272,7 +1302,7 @@ decode(const char *s) return (I_)m; } -static void +static void GNU_ATTRIBUTE(__noreturn__) bad_option(const char *s) { errorBelch("bad RTS option: %s", s);