X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsFlags.c;h=0794dc4c871d8e929f59b17056c595bd1cf6da4f;hb=88605454e4bf30d7fca2b0eea4643c5637afd5cc;hp=535d0fdcd265d626e60f53ea3d6fbf733277df84;hpb=7ddc8c386be03309f6bc395101b84ebdf637025e;p=ghc-hetmet.git diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 535d0fd..0794dc4 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -147,6 +147,7 @@ void initRtsFlagsDefaults(void) #endif RtsFlags.GcFlags.compact = rtsFalse; RtsFlags.GcFlags.compactThreshold = 30.0; + RtsFlags.GcFlags.sweep = rtsFalse; #ifdef RTS_GTK_FRONTPANEL RtsFlags.GcFlags.frontpanel = rtsFalse; #endif @@ -175,11 +176,14 @@ void initRtsFlagsDefaults(void) RtsFlags.DebugFlags.stable = rtsFalse; RtsFlags.DebugFlags.stm = rtsFalse; RtsFlags.DebugFlags.prof = rtsFalse; + RtsFlags.DebugFlags.eventlog = rtsFalse; RtsFlags.DebugFlags.gran = rtsFalse; RtsFlags.DebugFlags.par = rtsFalse; + RtsFlags.DebugFlags.apply = rtsFalse; RtsFlags.DebugFlags.linker = rtsFalse; RtsFlags.DebugFlags.squeeze = rtsFalse; RtsFlags.DebugFlags.hpc = rtsFalse; + RtsFlags.DebugFlags.timestamp = rtsFalse; #endif #if defined(PROFILING) || defined(PAR) @@ -203,16 +207,25 @@ void initRtsFlagsDefaults(void) RtsFlags.ProfFlags.bioSelector = NULL; #endif +#ifdef EVENTLOG + RtsFlags.EventLogFlags.doEventLogging = rtsFalse; +#endif + RtsFlags.MiscFlags.tickInterval = 20; /* In milliseconds */ RtsFlags.ConcFlags.ctxtSwitchTime = 20; /* In milliseconds */ RtsFlags.MiscFlags.install_signal_handlers = rtsTrue; + RtsFlags.MiscFlags.machineReadable = rtsFalse; + RtsFlags.MiscFlags.linkerMemBase = 0; #ifdef THREADED_RTS RtsFlags.ParFlags.nNodes = 1; RtsFlags.ParFlags.migrate = rtsTrue; RtsFlags.ParFlags.wakeupMigrate = rtsFalse; - RtsFlags.ParFlags.gcThreads = 1; + RtsFlags.ParFlags.parGcEnabled = 1; + RtsFlags.ParFlags.parGcGen = 1; + RtsFlags.ParFlags.parGcLoadBalancing = 1; + RtsFlags.ParFlags.setAffinity = 0; #endif #ifdef PAR @@ -315,9 +328,6 @@ void initRtsFlagsDefaults(void) RtsFlags.TickyFlags.tickyFile = NULL; #endif - RtsFlags.TraceFlags.timestamp = rtsFalse; - RtsFlags.TraceFlags.sched = rtsFalse; - #ifdef USE_PAPI /* By default no special measurements taken */ RtsFlags.PapiFlags.eventType = 0; @@ -343,7 +353,7 @@ usage_text[] = { " -K Sets the maximum stack size (default 8M) Egs: -K32k -K512k", " -k Sets the initial thread stack size (default 1k) Egs: -k4k -k2m", "", -" -A Sets the minimum allocation area size (default 256k) Egs: -A1m -A10k", +" -A Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k", " -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", " -H Sets the minimum heap size (default 0M) Egs: -H24m -H1G", " -m Minimum % of heap which must be available (default 3%)", @@ -352,13 +362,14 @@ usage_text[] = { " -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", +" -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)", #endif "", -" -t One-line GC statistics (default file: .stat)", -" -s Summary GC statistics (with -Sstderr going to stderr)", -" -S Detailed GC statistics", +" -t[] One-line GC statistics (if omitted, uses stderr)", +" -s[] Summary GC statistics (if omitted, uses stderr)", +" -S[] Detailed GC statistics (if omitted, uses stderr)", #ifdef RTS_GTK_FRONTPANEL " -f Display front panel (requires X11 & GTK+)", #endif @@ -403,6 +414,13 @@ usage_text[] = { "", # endif #endif /* PROFILING or PAR */ + +#ifdef EVENTLOG +"", +" -l Log runtime events (generates binary trace file .eventlog)", +"", +#endif + #if !defined(PROFILING) "", " -hT Heap residency profile (output file .hp)", @@ -424,8 +442,7 @@ usage_text[] = { " This sets the resolution for -C and the profile timer -i.", " Default: 0.02 sec.", "", -" -vs Trace scheduler events (see also -Ds with -debug)", -" -vt Time-stamp trace messages", +" -vt Time-stamp debug messages", "", #if defined(DEBUG) " -Ds DEBUG: scheduler", @@ -437,8 +454,10 @@ usage_text[] = { " -DS DEBUG: sanity", " -Dt DEBUG: stable", " -Dp DEBUG: prof", +" -De DEBUG: event logging", " -Dr DEBUG: gran", " -DP DEBUG: par", +" -Da DEBUG: apply", " -Dl DEBUG: linker", " -Dm DEBUG: stm", " -Dz DEBUG: stack squezing", @@ -446,8 +465,12 @@ usage_text[] = { "", #endif /* DEBUG */ #if defined(THREADED_RTS) && !defined(NOSMP) -" -N Use OS threads (default: 1)", -" -g Use OS threads for GC (default: 1)", +" -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", " -qm Don't automatically migrate threads between CPUs", " -qw Migrate a thread to the current CPU when it is woken up", #endif @@ -473,6 +496,10 @@ usage_text[] = { #if defined(GRAN) /* ToDo: fill in decent Docu here */ " -b... All GranSim options start with -b; see GranSim User's Guide for details", #endif +#if defined(x86_64_HOST_ARCH) +" -xm Base address to mmap memory in the GHCi linker", +" (hex; must be <80000000)", +#endif #if defined(USE_PAPI) " -aX CPU performance counter measurements using PAPI", " (use with the -s option). X is one of:", @@ -637,6 +664,14 @@ errorBelch("not built for: -prof"); \ error = rtsTrue; #endif +#ifdef EVENTLOG +# define EVENTLOG_BUILD_ONLY(x) x +#else +# define EVENTLOG_BUILD_ONLY(x) \ +errorBelch("not built for: -par-prof"); \ +error = rtsTrue; +#endif + #ifdef PAR # define PAR_BUILD_ONLY(x) x #else @@ -686,6 +721,10 @@ error = rtsTrue; &rts_argv[arg][2])) { RtsFlags.MiscFlags.install_signal_handlers = rtsFalse; } + else if (strequal("machine-readable", + &rts_argv[arg][2])) { + RtsFlags.MiscFlags.machineReadable = rtsTrue; + } else if (strequal("info", &rts_argv[arg][2])) { printRtsInfo(); @@ -749,6 +788,10 @@ error = rtsTrue; } break; + case 'w': + RtsFlags.GcFlags.sweep = rtsTrue; + break; + case 'F': RtsFlags.GcFlags.oldGenFactor = atof(rts_argv[arg]+2); @@ -790,6 +833,9 @@ error = rtsTrue; case 'p': RtsFlags.DebugFlags.prof = rtsTrue; break; + case 'e': + RtsFlags.DebugFlags.eventlog = rtsTrue; + break; case 'r': RtsFlags.DebugFlags.gran = rtsTrue; break; @@ -911,7 +957,7 @@ error = rtsTrue; { int r; r = open_stats_file(arg, *argc, argv, - *rts_argc, rts_argv, STAT_FILENAME_FMT, + *rts_argc, rts_argv, NULL, &RtsFlags.GcFlags.statsFile); if (r == -1) { error = rtsTrue; } } @@ -924,6 +970,14 @@ error = rtsTrue; /* =========== PROFILING ========================== */ + case 'l': +#ifdef EVENTLOG + RtsFlags.EventLogFlags.doEventLogging = rtsTrue; +#else + errorBelch("not built for: -eventlog"); +#endif + break; + case 'P': /* detailed cost centre profiling (time/alloc) */ case 'p': /* cost centre profiling (time/alloc) */ COST_CENTRE_USING_BUILD_ONLY( @@ -1117,25 +1171,19 @@ error = rtsTrue; #if defined(THREADED_RTS) && !defined(NOSMP) case 'N': THREADED_BUILD_ONLY( - if (rts_argv[arg][2] != '\0') { + if (rts_argv[arg][2] == '\0') { +#if defined(PROFILING) + RtsFlags.ParFlags.nNodes = 1; +#else + RtsFlags.ParFlags.nNodes = getNumberOfProcessors(); +#endif + } else { RtsFlags.ParFlags.nNodes = strtol(rts_argv[arg]+2, (char **) NULL, 10); if (RtsFlags.ParFlags.nNodes <= 0) { errorBelch("bad value for -N"); error = rtsTrue; } - } - ) break; - - case 'g': - THREADED_BUILD_ONLY( - if (rts_argv[arg][2] != '\0') { - RtsFlags.ParFlags.gcThreads - = strtol(rts_argv[arg]+2, (char **) NULL, 10); - if (RtsFlags.ParFlags.nNodes <= 0) { - errorBelch("bad value for -g"); - error = rtsTrue; - } #if defined(PROFILING) if (RtsFlags.ParFlags.nNodes > 1) { errorBelch("bad option %s: only -N1 is supported with profiling", rts_argv[arg]); @@ -1145,12 +1193,44 @@ error = rtsTrue; } ) break; + case 'g': + THREADED_BUILD_ONLY( + switch (rts_argv[arg][2]) { + case '1': + // backwards compat only + RtsFlags.ParFlags.parGcEnabled = rtsFalse; + break; + default: + errorBelch("unknown RTS option: %s",rts_argv[arg]); + error = rtsTrue; + break; + } + ) break; + case 'q': switch (rts_argv[arg][2]) { case '\0': 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') { + 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; + case 'a': + RtsFlags.ParFlags.setAffinity = rtsTrue; + break; case 'm': RtsFlags.ParFlags.migrate = rtsFalse; break; @@ -1216,10 +1296,11 @@ error = rtsTrue; error = rtsTrue; break; case 't': - RtsFlags.TraceFlags.timestamp = rtsTrue; + RtsFlags.DebugFlags.timestamp = rtsTrue; break; case 's': - RtsFlags.TraceFlags.sched = rtsTrue; + case 'g': + // ignored for backwards-compat break; default: errorBelch("unknown RTS option: %s",rts_argv[arg]); @@ -1247,7 +1328,22 @@ error = rtsTrue; } break; - case 'c': /* Debugging tool: show current cost centre on an exception */ +#if defined(x86_64_HOST_ARCH) + case 'm': /* linkerMemBase */ + if (rts_argv[arg][3] != '\0') { + RtsFlags.MiscFlags.linkerMemBase + = strtol(rts_argv[arg]+3, (char **) NULL, 16); + if (RtsFlags.MiscFlags.linkerMemBase > 0x80000000) { + errorBelch("-xm: value must be <80000000"); + error = rtsTrue; + } + } else { + RtsFlags.MiscFlags.linkerMemBase = 0; + } + break; +#endif + + case 'c': /* Debugging tool: show current cost centre on an exception */ PROFILING_BUILD_ONLY( RtsFlags.ProfFlags.showCCSOnException = rtsTrue; ); @@ -2331,16 +2427,17 @@ open_stats_file ( { FILE *f = NULL; - if (strequal(rts_argv[arg]+2, "stderr")) { /* use debugBelch */ + if (strequal(rts_argv[arg]+2, "stderr") + || (FILENAME_FMT == NULL && rts_argv[arg][2] == '\0')) { f = NULL; /* NULL means use debugBelch */ } else { - if (rts_argv[arg][2] != '\0') { /* stats file specified */ - f = fopen(rts_argv[arg]+2,"w"); - } else { - char stats_filename[STATS_FILENAME_MAXLEN]; /* default . */ - sprintf(stats_filename, FILENAME_FMT, argv[0]); - f = fopen(stats_filename,"w"); - } + if (rts_argv[arg][2] != '\0') { /* stats file specified */ + f = fopen(rts_argv[arg]+2,"w"); + } else { + char stats_filename[STATS_FILENAME_MAXLEN]; /* default . */ + sprintf(stats_filename, FILENAME_FMT, argv[0]); + f = fopen(stats_filename,"w"); + } if (f == NULL) { errorBelch("Can't open stats file %s\n", rts_argv[arg]+2); return -1;