/* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.27 2000/03/08 17:48:24 simonmar Exp $
+ * $Id: RtsFlags.c,v 1.68 2003/04/21 14:45:28 sof Exp $
*
* (c) The AQUA Project, Glasgow University, 1994-1997
* (c) The GHC Team, 1998-1999
//@node Includes, Constants
//@subsection Includes
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "BlockAlloc.h"
-#include "ProfRts.h"
+#include "Timer.h" /* CS_MIN_MILLISECS */
+#include "Profiling.h"
-#if defined(PROFILING)
-#include "Itimer.h"
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
#endif
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
extern struct RTS_FLAGS RtsFlags;
/*
* Split argument lists
*/
-int prog_argc; /* an "int" so as to match normal "argc" */
+int prog_argc = 0; /* an "int" so as to match normal "argc" */
char **prog_argv = NULL;
-int rts_argc; /* ditto */
+int rts_argc = 0; /* ditto */
char *rts_argv[MAX_RTS_ARGS];
//@node Constants, Static function decls, Includes
#if defined(GRAN)
-char *gran_debug_opts_strs[] = {
+static char *gran_debug_opts_strs[] = {
"DEBUG (-bDe, -bD1): event_trace; printing event trace.\n",
"DEBUG (-bDE, -bD2): event_stats; printing event statistics.\n",
"DEBUG (-bDb, -bD4): bq; check blocking queues\n",
};
/* one character codes for the available debug options */
-char gran_debug_opts_flags[] = {
+static char gran_debug_opts_flags[] = {
'e', 'E', 'b', 'G', 'q', 'f', 'r', 'F', 'u', 'S', ':', 'o', 'z', 'P', 't'
};
-/* prefix strings printed with the debug messages of the corresponding type */
-char *gran_debug_opts_prefix[] = {
- "", /* event_trace */
- "", /* event_stats */
- "##", /* bq */
- "**", /* pack */
- "^^", /* checkSparkQ */
- "==", /* thunkStealing */
- "^^", /* randomSteal */
- "+-", /* findWork */
- "", /* unused */
- "++", /* pri */
- "::", /* checkLight */
- "##", /* sortedQ */
- "", /* blockOnFetch */
- "", /* packBuffer */
- "" /* blockOnFetch_sanity */
-};
-
#elif defined(PAR)
-char *par_debug_opts_strs[] = {
+static char *par_debug_opts_strs[] = {
"DEBUG (-qDv, -qD1): verbose; be generally verbose with parallel related stuff.\n",
- "DEBUG (-qDt, -qD2): trace; trace messages.\n",
+ "DEBUG (-qDq, -qD2): bq; print blocking queues.\n",
"DEBUG (-qDs, -qD4): schedule; scheduling of parallel threads.\n",
"DEBUG (-qDe, -qD8): free; free messages.\n",
"DEBUG (-qDr, -qD16): resume; resume messages.\n",
- "DEBUG (-qDw, -qD32): weight; print weights for GC.\n",
+ "DEBUG (-qDw, -qD32): weight; print weights and distrib GC stuff.\n",
"DEBUG (-qDF, -qD64): fetch; fetch messages.\n",
- "DEBUG (-qDa, -qD128): ack; ack messages.\n",
- "DEBUG (-qDf, -qD256): fish; fish messages.\n",
- "DEBUG (-qDo, -qD512): forward; forwarding messages to other PEs.\n",
- "DEBUG (-qDp, -qD1024): pack; packing and unpacking graphs.\n"
+ // "DEBUG (-qDa, -qD128): ack; ack messages.\n",
+ "DEBUG (-qDf, -qD128): fish; fish messages.\n",
+ //"DEBUG (-qDo, -qD512): forward; forwarding messages to other PEs.\n",
+ "DEBUG (-qDl, -qD256): tables; print internal LAGA etc tables.\n",
+ "DEBUG (-qDo, -qD512): packet; packets and graph structures when packing.\n",
+ "DEBUG (-qDp, -qD1024): pack; packing and unpacking graphs.\n",
+ "DEBUG (-qDz, -qD2048): paranoia; ridiculously detailed output (excellent for filling a partition).\n"
};
/* one character codes for the available debug options */
-char par_debug_opts_flags[] = {
- 'v', 't', 's', 'e', 'r', 'w', 'F', 'a', 'f', 'o', 'p'
-};
-
-/* prefix strings printed with the debug messages of the corresponding type */
-char *par_debug_opts_prefix[] = {
- " ", /* verbose */
- "..", /* trace */
- "--", /* schedule */
- "!!", /* free */
- "[]", /* resume */
- ";;", /* weight */
- "%%", /* fetch */
- ",,", /* ack */
- "$$", /* fish */
- "", /* forward */
- "**" /* pack */
+static char par_debug_opts_flags[] = {
+ 'v', 'q', 's', 'e', 'r', 'w', 'F', 'f', 'l', 'o', 'p', 'z'
};
#endif /* PAR */
RtsFlags.GcFlags.minAllocAreaSize = (256 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE;
- RtsFlags.GcFlags.maxHeapSize = (64 * 1024 * 1024) / BLOCK_SIZE;
+ RtsFlags.GcFlags.maxHeapSize = 0; /* off by default */
RtsFlags.GcFlags.heapSizeSuggestion = 0; /* none */
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
RtsFlags.GcFlags.oldGenFactor = 2;
+#if defined(PAR)
+ /* A hack currently needed for GUM -- HWL */
+ RtsFlags.GcFlags.generations = 1;
+ RtsFlags.GcFlags.steps = 2;
+ RtsFlags.GcFlags.squeezeUpdFrames = rtsFalse;
+#else
RtsFlags.GcFlags.generations = 2;
RtsFlags.GcFlags.steps = 2;
-
- RtsFlags.GcFlags.forceGC = rtsFalse;
- RtsFlags.GcFlags.forcingInterval = 5000000; /* 5MB (or words?) */
- RtsFlags.GcFlags.ringBell = rtsFalse;
-
RtsFlags.GcFlags.squeezeUpdFrames = rtsTrue;
+#endif
+ RtsFlags.GcFlags.compact = rtsFalse;
+ RtsFlags.GcFlags.compactThreshold = 30.0;
+#ifdef RTS_GTK_FRONTPANEL
+ RtsFlags.GcFlags.frontpanel = rtsFalse;
+#endif
+
+#ifdef DEBUG
+ RtsFlags.DebugFlags.scheduler = rtsFalse;
+ RtsFlags.DebugFlags.interpreter = rtsFalse;
+ RtsFlags.DebugFlags.codegen = rtsFalse;
+ RtsFlags.DebugFlags.weak = rtsFalse;
+ RtsFlags.DebugFlags.gccafs = rtsFalse;
+ RtsFlags.DebugFlags.gc = rtsFalse;
+ RtsFlags.DebugFlags.block_alloc = rtsFalse;
+ RtsFlags.DebugFlags.sanity = rtsFalse;
+ RtsFlags.DebugFlags.stable = rtsFalse;
+ RtsFlags.DebugFlags.prof = rtsFalse;
+ RtsFlags.DebugFlags.gran = rtsFalse;
+ RtsFlags.DebugFlags.par = rtsFalse;
+ RtsFlags.DebugFlags.linker = rtsFalse;
+#endif
#if defined(PROFILING) || defined(PAR)
RtsFlags.CcFlags.doCostCentres = 0;
#endif /* PROFILING or PAR */
#ifdef PROFILING
- RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
+ RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
+ RtsFlags.ProfFlags.profileInterval = 100;
+ RtsFlags.ProfFlags.includeTSOs = rtsFalse;
RtsFlags.ProfFlags.showCCSOnException = rtsFalse;
+ RtsFlags.ProfFlags.maxRetainerSetSize = 8;
+ RtsFlags.ProfFlags.modSelector = NULL;
+ RtsFlags.ProfFlags.descrSelector = NULL;
+ RtsFlags.ProfFlags.typeSelector = NULL;
+ RtsFlags.ProfFlags.ccSelector = NULL;
+ RtsFlags.ProfFlags.ccsSelector = NULL;
+ RtsFlags.ProfFlags.retainerSelector = NULL;
+ RtsFlags.ProfFlags.bioSelector = NULL;
- RtsFlags.ProfFlags.ccSelector = NULL;
- RtsFlags.ProfFlags.modSelector = NULL;
- RtsFlags.ProfFlags.descrSelector = NULL;
- RtsFlags.ProfFlags.typeSelector = NULL;
- RtsFlags.ProfFlags.kindSelector = NULL;
#elif defined(DEBUG)
- RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
+ RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
#endif
RtsFlags.ConcFlags.ctxtSwitchTime = CS_MIN_MILLISECS; /* In milliseconds */
#ifdef PAR
RtsFlags.ParFlags.ParStats.Full = rtsFalse;
+ RtsFlags.ParFlags.ParStats.Suppressed = rtsFalse;
RtsFlags.ParFlags.ParStats.Binary = rtsFalse;
RtsFlags.ParFlags.ParStats.Sparks = rtsFalse;
RtsFlags.ParFlags.ParStats.Heap = rtsFalse;
RtsFlags.ParFlags.ParStats.Global = rtsFalse;
RtsFlags.ParFlags.outputDisabled = rtsFalse;
+#ifdef DIST
+ RtsFlags.ParFlags.doFairScheduling = rtsTrue; /* fair sched by def */
+#else
+ RtsFlags.ParFlags.doFairScheduling = rtsFalse; /* unfair sched by def */
+#endif
RtsFlags.ParFlags.packBufferSize = 1024;
-
+ RtsFlags.ParFlags.thunksToPack = 1; /* 0 ... infinity; */
+ RtsFlags.ParFlags.globalising = 1; /* 0 ... everything */
RtsFlags.ParFlags.maxThreads = 1024;
RtsFlags.ParFlags.maxFishes = MAX_FISHES;
RtsFlags.ParFlags.fishDelay = FISH_DELAY;
#if defined(GRAN)
/* ToDo: check defaults for GranSim and GUM */
- RtsFlags.ConcFlags.ctxtSwitchTime = CS_MIN_MILLISECS; /* In milliseconds */
- RtsFlags.ConcFlags.maxThreads = 65536; // refers to mandatory threads
RtsFlags.GcFlags.maxStkSize = (1024 * 1024) / sizeof(W_);
RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_);
+ RtsFlags.GranFlags.maxThreads = 65536; // refers to mandatory threads
RtsFlags.GranFlags.GranSimStats.Full = rtsFalse;
RtsFlags.GranFlags.GranSimStats.Suppressed = rtsFalse;
RtsFlags.GranFlags.GranSimStats.Binary = rtsFalse;
"",
"The following run time system options are available:",
"",
-" -? -f Prints this message and exits; the program is not executed",
+" -? Prints this message and exits; the program is not executed",
"",
" -K<size> Sets the maximum stack size (default 1M) Egs: -K32k -K512k",
" -k<size> Sets the initial thread stack size (default 1k) Egs: -K4k -K2m",
"",
" -A<size> Sets the minimum allocation area size (default 256k) Egs: -A1m -A10k",
-" -M<size> Sets the maximum heap size (default 64M) Egs: -M256k -M1G",
+" -M<size> Sets the maximum heap size (default unlimited) Egs: -M256k -M1G",
" -H<size> Sets the minimum heap size (default 0M) Egs: -H24m -H1G",
-" -m<n>% Minimum % of heap which must be available (default 3%)",
+" -m<n> Minimum % of heap which must be available (default 3%)",
" -G<n> Number of generations (default: 2)",
" -T<n> Number of steps in younger generations (default: 2)",
-" -s<file> Summary GC statistics (default file: <program>.stat)",
-" -S<file> Detailed GC statistics (with -Sstderr going to stderr)",
+" -c<n> Auto-enable compaction of the oldest generation when live data is",
+" at least <n>% of the maximum heap size set with -M (default: 30%)",
+" -c Enable compaction for all major collections",
+"",
+" -t<file> One-line GC statistics (default file: <program>.stat)",
+" -s<file> Summary GC statistics (with -Sstderr going to stderr)",
+" -S<file> Detailed GC statistics",
+#ifdef RTS_GTK_FRONTPANEL
+" -f Display front panel (requires X11 & GTK+)",
+#endif
"",
"",
" -Z Don't squeeze out update frames on stack overflow",
" -B Sound the bell at the start of each garbage collection",
#if defined(PROFILING) || defined(PAR)
"",
-" -p<sort> Produce cost centre time profile (output file <program>.prof)",
-" sort: T = time (default), A = alloc, C = cost centre label",
-" -P<sort> Produce serial time profile (output file <program>.time)",
-" and a -p profile with detailed tick/alloc info",
+" -px Time/allocation profile (XML) (output file <program>.prof)",
+" -p Time/allocation profile (output file <program>.prof)",
+" -P More detailed Time/Allocation profile",
+" -Pa Give information about *all* cost centres",
+
# if defined(PROFILING)
"",
-" -h<break-down> Heap residency profile (output file <program>.hp)",
-" break-down: C = cost centre stack (default), M = module",
-" D = closure description, Y = type description",
-" T<ints>,<start> = time closure created",
-" ints: no. of interval bands plotted (default 18)",
-" start: seconds after which intervals start (default 0.0)",
-" A subset of closures may be selected by the attached cost centre using:",
-" -c{mod:lab,mod:lab...}, specific module:label cost centre(s)",
-" -m{mod,mod...} all cost centres from the specified modules(s)",
-" Selections can also be made by description, type, kind and age:",
-" -d{des,des...} closures with specified closure descriptions",
-" -y{typ,typ...} closures with specified type descriptions",
-" -k{knd,knd...} closures of the specified kinds",
-" -a<age> closures which survived <age> complete intervals",
-" The selection logic used is summarised as follows:",
-" ([-c] or [-m] or [-g]) and ([-d] or [-y] or [-k]) and [-a]",
-" where an option is true if not specified",
+" -hx Heap residency profile (XML) (output file <program>.prof)",
+" -h<break-down> Heap residency profile (hp2ps) (output file <program>.hp)",
+" break-down: c = cost centre stack (default)",
+" m = module",
+" d = closure description",
+" y = type description",
+" r = retainer",
+" b = biography (LAG,DRAG,VOID,USE)",
+" A subset of closures may be selected thusly:",
+" -hc<cc>,... specific cost centre(s) (top of stack only)",
+" -hC<cc>,... specific cost centre(s) (anywhere in stack)",
+" -hm<mod>... all cost centres from the specified modules(s)",
+" -hd<des>,... closures with specified closure descriptions",
+" -hy<typ>... closures with specified type descriptions",
+" -hr<cc>... closures with specified retainers",
+" -hb<bio>... closures with specified biographies (lag,drag,void,use)",
"",
-" -xc Show current cost centre stack on raising an exception",
-# endif
+" -R<size> Set the maximum retainer set size (default: 8)",
+"",
+" -i<sec> Time between heap samples (seconds, default: 0.1)",
"",
-" -z<tbl><size> set hash table <size> for <tbl> (C, M, G, D or Y)",
+" -xt Include threads (TSOs) in a heap profile",
"",
-" -i<secs> Number of seconds in a profiling interval (default 1.0):",
-" heap profile (-h) and/or serial time profile (-P) frequency",
+" -xc Show current cost centre stack on raising an exception",
+# endif
#endif /* PROFILING or PAR */
#if !defined(PROFILING) && defined(DEBUG)
"",
#endif
" -C<secs> Context-switch interval in seconds",
" (0 or no argument means switch as often as possible)",
-" the default is .01 sec; resolution is .01 sec",
+" the default is .02 sec; resolution is .02 sec",
+"",
+#if defined(DEBUG)
+" -Ds DEBUG: scheduler",
+" -Di DEBUG: interpreter",
+" -Dc DEBUG: codegen",
+" -Dw DEBUG: weak",
+" -DG DEBUG: gccafs",
+" -Dg DEBUG: gc",
+" -Db DEBUG: block",
+" -DS DEBUG: sanity",
+" -Dt DEBUG: stable",
+" -Dp DEBUG: prof",
+" -Dr DEBUG: gran",
+" -DP DEBUG: par",
+" -Dl DEBUG: linker",
+"",
+#endif // DEBUG
#if defined(SMP)
" -N<n> Use <n> OS threads (default: 1)",
#endif
" -b... All GranSim options start with -b; see GranSim User's Guide for details",
#endif
"",
+"RTS options may also be specified using the GHCRTS environment variable.",
+"",
"Other RTS options may be available for programs compiled a different way.",
"The GHC User's Guide has full details.",
"",
return(strcmp(a, b) == 0);
}
+static void
+splitRtsFlags(char *s, int *rts_argc, char *rts_argv[])
+{
+ char *c1, *c2;
+
+ c1 = s;
+ do {
+ while (isspace(*c1)) { c1++; };
+ c2 = c1;
+ while (!isspace(*c2) && *c2 != '\0') { c2++; };
+
+ if (c1 == c2) { break; }
+
+ if (*rts_argc < MAX_RTS_ARGS-1) {
+ s = stgMallocBytes(c2-c1+1, "RtsFlags.c:splitRtsFlags()");
+ strncpy(s, c1, c2-c1);
+ s[c2-c1] = '\0';
+ rts_argv[(*rts_argc)++] = s;
+ } else {
+ barf("too many RTS arguments (max %d)", MAX_RTS_ARGS-1);
+ }
+
+ c1 = c2;
+ } while (*c1 != '\0');
+}
+
void
setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[])
{
if ((last_slash = (char *) strrchr(argv[0], '/')) != NULL)
strcpy(argv[0], last_slash+1);
- /* Split arguments (argv) into PGM (argv) and RTS (rts_argv) parts */
- /* argv[0] must be PGM argument -- leave in argv */
-
total_arg = *argc;
arg = 1;
*argc = 1;
*rts_argc = 0;
- for (mode = PGM; arg < total_arg && ! strequal("--RTS", argv[arg]); arg++) {
- if (strequal("+RTS", argv[arg])) {
+ // process arguments from the ghc_rts_opts global variable first.
+ // (arguments from the GHCRTS environment variable and the command
+ // line override these).
+ {
+ if (ghc_rts_opts != NULL) {
+ splitRtsFlags(ghc_rts_opts, rts_argc, rts_argv);
+ }
+ }
+
+ // process arguments from the GHCRTS environment variable next
+ // (arguments from the command line override these).
+ {
+ char *ghc_rts = getenv("GHCRTS");
+
+ if (ghc_rts != NULL) {
+ splitRtsFlags(ghc_rts, rts_argc, rts_argv);
+ }
+ }
+
+ // Split arguments (argv) into PGM (argv) and RTS (rts_argv) parts
+ // argv[0] must be PGM argument -- leave in argv
+
+ for (mode = PGM; arg < total_arg; arg++) {
+ // The '--RTS' argument disables all future +RTS ... -RTS processing.
+ if (strequal("--RTS", argv[arg])) {
+ arg++;
+ break;
+ }
+ // The '--' argument is passed through to the program, but
+ // disables all further +RTS ... -RTS processing.
+ else if (strequal("--", argv[arg])) {
+ break;
+ }
+ else if (strequal("+RTS", argv[arg])) {
mode = RTS;
}
else if (strequal("-RTS", argv[arg])) {
barf("too many RTS arguments (max %d)", MAX_RTS_ARGS-1);
}
}
- if (arg < total_arg) {
- /* arg must be --RTS; process remaining program arguments */
- while (++arg < total_arg) {
- argv[(*argc)++] = argv[arg];
- }
+ // process remaining program arguments
+ for (; arg < total_arg; arg++) {
+ argv[(*argc)++] = argv[arg];
}
argv[*argc] = (char *) 0;
rts_argv[*rts_argc] = (char *) 0;
- /* Process RTS (rts_argv) part: mainly to determine statsfile */
-
+ // Process RTS (rts_argv) part: mainly to determine statsfile
for (arg = 0; arg < *rts_argc; arg++) {
if (rts_argv[arg][0] != '-') {
fflush(stdout);
# define SMP_BUILD_ONLY(x) x
#else
# define SMP_BUILD_ONLY(x) \
-prog_belch("GHC not built for: -parallel"); \
+prog_belch("GHC not built for: -smp"); \
error = rtsTrue;
#endif
/* =========== GENERAL ========================== */
case '?':
- case 'f':
error = rtsTrue;
break;
RtsFlags.GcFlags.ringBell = rtsTrue;
break;
+ case 'c':
+ if (rts_argv[arg][2] != '\0') {
+ RtsFlags.GcFlags.compactThreshold =
+ atof(rts_argv[arg]+2);
+ } else {
+ RtsFlags.GcFlags.compact = rtsTrue;
+ }
+ break;
+
case 'F':
RtsFlags.GcFlags.oldGenFactor = atof(rts_argv[arg]+2);
#ifdef DEBUG
case 'D':
- /* hack warning: interpret the flags as a binary number */
- {
- I_ n = decode(rts_argv[arg]+2);
- if (n &1) RtsFlags.DebugFlags.scheduler = rtsTrue;
- if ((n>>1)&1) RtsFlags.DebugFlags.evaluator = rtsTrue;
- if ((n>>2)&1) RtsFlags.DebugFlags.codegen = rtsTrue;
- if ((n>>3)&1) RtsFlags.DebugFlags.weak = rtsTrue;
- if ((n>>4)&1) RtsFlags.DebugFlags.gccafs = rtsTrue;
- if ((n>>5)&1) RtsFlags.DebugFlags.gc = rtsTrue;
- if ((n>>6)&1) RtsFlags.DebugFlags.block_alloc = rtsTrue;
- if ((n>>7)&1) RtsFlags.DebugFlags.sanity = rtsTrue;
- if ((n>>8)&1) RtsFlags.DebugFlags.stable = rtsTrue;
- if ((n>>9)&1) RtsFlags.DebugFlags.prof = rtsTrue;
- if ((n>>10)&1) RtsFlags.DebugFlags.gran = rtsTrue;
- if ((n>>11)&1) RtsFlags.DebugFlags.par = rtsTrue;
- }
- break;
+ {
+ char *c;
+
+ for (c = rts_argv[arg] + 2; *c != '\0'; c++) {
+ switch (*c) {
+ case 's':
+ RtsFlags.DebugFlags.scheduler = rtsTrue;
+ break;
+ case 'i':
+ RtsFlags.DebugFlags.interpreter = rtsTrue;
+ break;
+ case 'c':
+ RtsFlags.DebugFlags.codegen = rtsTrue;
+ break;
+ case 'w':
+ RtsFlags.DebugFlags.weak = rtsTrue;
+ break;
+ case 'G':
+ RtsFlags.DebugFlags.gccafs = rtsTrue;
+ break;
+ case 'g':
+ RtsFlags.DebugFlags.gc = rtsTrue;
+ break;
+ case 'b':
+ RtsFlags.DebugFlags.block_alloc = rtsTrue;
+ break;
+ case 'S':
+ RtsFlags.DebugFlags.sanity = rtsTrue;
+ break;
+ case 't':
+ RtsFlags.DebugFlags.stable = rtsTrue;
+ break;
+ case 'p':
+ RtsFlags.DebugFlags.prof = rtsTrue;
+ break;
+ case 'r':
+ RtsFlags.DebugFlags.gran = rtsTrue;
+ break;
+ case 'P':
+ RtsFlags.DebugFlags.par = rtsTrue;
+ break;
+ case 'l':
+ RtsFlags.DebugFlags.linker = rtsTrue;
+ break;
+ case 'a':
+ RtsFlags.DebugFlags.apply = rtsTrue;
+ break;
+ default:
+ bad_option( rts_argv[arg] );
+ }
+ }
+ break;
+ }
#endif
case 'K':
}
break;
- case 'j': /* force GC option */
- RtsFlags.GcFlags.forceGC = rtsTrue;
- if (rts_argv[arg][2]) {
- RtsFlags.GcFlags.forcingInterval
- = decode(rts_argv[arg]+2) / sizeof(W_);
- }
- break;
+#ifdef RTS_GTK_FRONTPANEL
+ case 'f':
+ RtsFlags.GcFlags.frontpanel = rtsTrue;
+ break;
+#endif
case 'S':
- RtsFlags.GcFlags.giveStats ++;
+ RtsFlags.GcFlags.giveStats = VERBOSE_GC_STATS;
+ goto stats;
case 's':
- RtsFlags.GcFlags.giveStats ++;
+ RtsFlags.GcFlags.giveStats = SUMMARY_GC_STATS;
+ goto stats;
+
+ case 't':
+ RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
+ goto stats;
+
+ stats:
#ifdef PAR
/* Opening all those files would almost certainly fail... */
- RtsFlags.ParFlags.ParStats.Full = rtsTrue;
+ // RtsFlags.ParFlags.ParStats.Full = rtsTrue;
RtsFlags.GcFlags.statsFile = stderr; /* temporary; ToDo: rm */
#else
- RtsFlags.GcFlags.statsFile
- = open_stats_file(arg, *argc, argv,
- *rts_argc, rts_argv, STAT_FILENAME_FMT);
-
- if (RtsFlags.GcFlags.statsFile == NULL) error = rtsTrue;
+ RtsFlags.GcFlags.statsFile
+ = open_stats_file(arg, *argc, argv,
+ *rts_argc, rts_argv, STAT_FILENAME_FMT);
+
+ if (RtsFlags.GcFlags.statsFile == NULL) error = rtsTrue;
#endif
- break;
+ break;
case 'Z':
RtsFlags.GcFlags.squeezeUpdFrames = rtsFalse;
/* =========== PROFILING ========================== */
case 'P': /* detailed cost centre profiling (time/alloc) */
- COST_CENTRE_USING_BUILD_ONLY(
- RtsFlags.CcFlags.doCostCentres = COST_CENTRES_VERBOSE;
- )
case 'p': /* cost centre profiling (time/alloc) */
COST_CENTRE_USING_BUILD_ONLY(
switch (rts_argv[arg][2]) {
case 'x':
RtsFlags.CcFlags.doCostCentres = COST_CENTRES_XML;
break;
- default:
- RtsFlags.CcFlags.doCostCentres = COST_CENTRES_SUMMARY;
+ case 'a':
+ RtsFlags.CcFlags.doCostCentres = COST_CENTRES_ALL;
break;
+ default:
+ if (rts_argv[arg][1] == 'P') {
+ RtsFlags.CcFlags.doCostCentres =
+ COST_CENTRES_VERBOSE;
+ } else {
+ RtsFlags.CcFlags.doCostCentres =
+ COST_CENTRES_SUMMARY;
+ }
+ break;
}
) break;
- case 'i': /* serial profiling -- initial timer interval */
- COST_CENTRE_USING_BUILD_ONLY(
- interval_ticks = (I_) ((atof(rts_argv[arg]+2) * TICK_FREQUENCY));
- if (interval_ticks <= 0)
- interval_ticks = 1;
- ) break;
+ case 'R':
+ PROFILING_BUILD_ONLY(
+ RtsFlags.ProfFlags.maxRetainerSetSize = atof(rts_argv[arg]+2);
+ ) break;
case 'h': /* serial heap profile */
#if !defined(PROFILING) && defined(DEBUG)
#else
PROFILING_BUILD_ONLY(
switch (rts_argv[arg][2]) {
- case '\0':
- case CCchar:
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_CCS;
- break;
- case MODchar:
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_MOD;
- break;
- case DESCRchar:
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_DESCR;
- break;
- case TYPEchar:
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_TYPE;
- break;
- case TIMEchar:
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_TIME;
- if (rts_argv[arg][3]) {
- char *start_str = strchr(rts_argv[arg]+3, ',');
- I_ intervals;
- if (start_str) *start_str = '\0';
-
- if ((intervals = decode(rts_argv[arg]+3)) != 0) {
- time_intervals = (hash_t) intervals;
- /* ToDo: and what if it *is* zero intervals??? */
- }
- if (start_str) {
- earlier_ticks = (I_)((atof(start_str + 1) * TICK_FREQUENCY));
+ case '\0':
+ case 'C':
+ case 'c':
+ case 'M':
+ case 'm':
+ case 'D':
+ case 'd':
+ case 'Y':
+ case 'y':
+ case 'R':
+ case 'r':
+ case 'B':
+ case 'b':
+ if (rts_argv[arg][2] != '\0' && rts_argv[arg][3] != '\0') {
+ {
+ char *left = strchr(rts_argv[arg], '{');
+ char *right = strrchr(rts_argv[arg], '}');
+
+ // curly braces are optional, for
+ // backwards compat.
+ if (left)
+ left = left+1;
+ else
+ left = rts_argv[arg] + 3;
+
+ if (!right)
+ right = rts_argv[arg] + strlen(rts_argv[arg]);
+
+ *right = '\0';
+
+ switch (rts_argv[arg][2]) {
+ case 'c': // cost centre label select
+ RtsFlags.ProfFlags.ccSelector = left;
+ break;
+ case 'C':
+ RtsFlags.ProfFlags.ccsSelector = left;
+ break;
+ case 'M':
+ case 'm': // cost centre module select
+ RtsFlags.ProfFlags.modSelector = left;
+ break;
+ case 'D':
+ case 'd': // closure descr select
+ RtsFlags.ProfFlags.descrSelector = left;
+ break;
+ case 'Y':
+ case 'y': // closure type select
+ RtsFlags.ProfFlags.typeSelector = left;
+ break;
+ case 'R':
+ case 'r': // retainer select
+ RtsFlags.ProfFlags.retainerSelector = left;
+ break;
+ case 'B':
+ case 'b': // biography select
+ RtsFlags.ProfFlags.bioSelector = left;
+ break;
+ }
}
+ break;
}
- break;
- default:
- prog_belch("invalid heap profile option: %s",rts_argv[arg]);
- error = rtsTrue;
- }
- )
-#endif
- break;
- case 'z': /* size of index tables */
- PROFILING_BUILD_ONLY(
- switch (rts_argv[arg][2]) {
- case CCchar:
- max_cc_no = (hash_t) decode(rts_argv[arg]+3);
- if (max_cc_no == 0) {
- prog_belch("bad number of cost centres %s", rts_argv[arg]);
- error = rtsTrue;
- }
- break;
- case MODchar:
- max_mod_no = (hash_t) decode(rts_argv[arg]+3);
- if (max_mod_no == 0) {
- prog_belch("bad number of modules %s", rts_argv[arg]);
- error = rtsTrue;
- }
- break;
- case DESCRchar:
- max_descr_no = (hash_t) decode(rts_argv[arg]+3);
- if (max_descr_no == 0) {
- prog_belch("bad number of closure descriptions %s",
- rts_argv[arg]);
+ if (RtsFlags.ProfFlags.doHeapProfile != 0) {
+ prog_belch("multiple heap profile options");
error = rtsTrue;
+ break;
}
- break;
- case TYPEchar:
- max_type_no = (hash_t) decode(rts_argv[arg]+3);
- if (max_type_no == 0) {
- prog_belch("bad number of type descriptions %s",
- rts_argv[arg]);
- error = rtsTrue;
+
+ switch (rts_argv[arg][2]) {
+ case '\0':
+ case 'C':
+ case 'c':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_CCS;
+ break;
+ case 'M':
+ case 'm':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_MOD;
+ break;
+ case 'D':
+ case 'd':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_DESCR;
+ break;
+ case 'Y':
+ case 'y':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_TYPE;
+ break;
+ case 'R':
+ case 'r':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_RETAINER;
+ break;
+ case 'B':
+ case 'b':
+ RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_LDV;
+ break;
}
break;
- default:
- prog_belch("invalid index table size option: %s",
- rts_argv[arg]);
+
+ default:
+ prog_belch("invalid heap profile option: %s",rts_argv[arg]);
error = rtsTrue;
}
- ) break;
+ )
+#endif // PROFILING
+ break;
- case 'c': /* cost centre label select */
- case 'd': /* closure descr select */
- case 'y': /* closure type select */
- PROFILING_BUILD_ONLY(
- {char *left = strchr(rts_argv[arg], '{');
- char *right = strrchr(rts_argv[arg], '}');
-
- if (! left || ! right ||
- strrchr(rts_argv[arg], '{') != left ||
- strchr(rts_argv[arg], '}') != right) {
- prog_belch("invalid heap profiling selection bracketing: %s",
- rts_argv[arg]);
- error = rtsTrue;
+#if defined(PROFILING)
+ case 'i': /* heap sample interval */
+ if (rts_argv[arg][2] == '\0') {
+ /* use default */
} else {
- *right = '\0';
- switch (rts_argv[arg][1]) {
- case 'c': /* cost centre label select */
- RtsFlags.ProfFlags.ccSelector = left + 1;
- break;
- case 'm': /* cost centre module select */
- RtsFlags.ProfFlags.modSelector = left + 1;
- break;
- case 'd': /* closure descr select */
- RtsFlags.ProfFlags.descrSelector = left + 1;
- break;
- case 'y': /* closure type select */
- RtsFlags.ProfFlags.typeSelector = left + 1;
- break;
- case 'k': /* closure kind select */
- RtsFlags.ProfFlags.kindSelector = left + 1;
- break;
- }
- }}
- ) break;
+ I_ cst; /* tmp */
+
+ /* Convert to milliseconds */
+ cst = (I_) ((atof(rts_argv[arg]+2) * 1000));
+ cst = (cst / CS_MIN_MILLISECS) * CS_MIN_MILLISECS;
+ if (cst != 0 && cst < CS_MIN_MILLISECS)
+ cst = CS_MIN_MILLISECS;
+
+ RtsFlags.ProfFlags.profileInterval = cst;
+ }
+ break;
+#endif
/* =========== CONCURRENT ========================= */
case 'C': /* context switch interval */
/* Convert to milliseconds */
cst = (I_) ((atof(rts_argv[arg]+2) * 1000));
cst = (cst / CS_MIN_MILLISECS) * CS_MIN_MILLISECS;
- if (cst < CS_MIN_MILLISECS)
+ if (cst != 0 && cst < CS_MIN_MILLISECS)
cst = CS_MIN_MILLISECS;
RtsFlags.ConcFlags.ctxtSwitchTime = cst;
case 'q':
PAR_BUILD_ONLY(
- process_par_option(arg, rts_argc, rts_argv, &error);
+ process_par_option(arg, rts_argc, rts_argv, &error);
) break;
/* =========== GRAN =============================== */
case 'b':
GRAN_BUILD_ONLY(
- process_gran_option(arg, rts_argc, rts_argv, &error);
+ process_gran_option(arg, rts_argc, rts_argv, &error);
) break;
/* =========== TICKY ============================== */
case 'c': /* Debugging tool: show current cost centre on an exception */
PROFILING_BUILD_ONLY(
- RtsFlags.ProfFlags.showCCSOnException = rtsTrue;
- ) break;
+ RtsFlags.ProfFlags.showCCSOnException = rtsTrue;
+ );
+ break;
+
+ case 't': /* Include memory used by TSOs in a heap profile */
+ PROFILING_BUILD_ONLY(
+ RtsFlags.ProfFlags.includeTSOs = rtsTrue;
+ );
+ break;
/* The option prefix '-xx' is reserved for future extension. KSW 1999-11. */
} else if (RtsFlags.GranFlags.proc > MAX_PROC ||
RtsFlags.GranFlags.proc < 1)
{
- fprintf(stderr,"setupRtsFlags: no more than %u processors
-allowed\n",
+ fprintf(stderr,"setupRtsFlags: no more than %u processors allowed\n",
MAX_PROC);
*error = rtsTrue;
}
static void
process_par_option(int arg, int *rts_argc, char *rts_argv[], rtsBool *error)
{
- if (rts_argv[arg][1] != 'q') /* All GUM options start with -q */
+
+ if (rts_argv[arg][1] != 'q') { /* All GUM options start with -q */
+ belch("Warning: GUM option does not start with -q: %s", rts_argv[arg]);
return;
-
+ }
+
/* Communication and task creation cost parameters */
switch(rts_argv[arg][2]) {
case 'e': /* -qe<n> ... allow <n> local sparks */
RtsFlags.ParFlags.maxFishes));
break;
-
- case 'd':
+ case 'F':
if (rts_argv[arg][3] != '\0') {
RtsFlags.ParFlags.fishDelay
= strtol(rts_argv[arg]+3, (char **) NULL, 10);
} else {
- belch("setupRtsFlags: missing fish delay time for -qd\n");
+ belch("setupRtsFlags: missing fish delay time for -qF\n");
*error = rtsTrue;
}
IF_PAR_DEBUG(verbose,
- belch("-qd<n>: fish delay time %d",
+ belch("-qF<n>: fish delay time %d us",
RtsFlags.ParFlags.fishDelay));
break;
belch("-qO: output disabled"));
break;
+ case 'g': /* -qg<n> ... globalisation scheme */
+ if (rts_argv[arg][3] != '\0') {
+ RtsFlags.ParFlags.globalising = decode(rts_argv[arg]+3);
+ } else {
+ belch("setupRtsFlags: missing identifier for globalisation scheme (for -qg)\n");
+ *error = rtsTrue;
+ }
+ IF_PAR_DEBUG(verbose,
+ belch("-qg<n>: globalisation scheme set to %d",
+ RtsFlags.ParFlags.globalising));
+ break;
+
+ case 'h': /* -qh<n> ... max number of thunks (except root) in packet */
+ if (rts_argv[arg][3] != '\0') {
+ RtsFlags.ParFlags.thunksToPack = decode(rts_argv[arg]+3);
+ } else {
+ belch("setupRtsFlags: missing number of thunks per packet (for -qh)\n");
+ *error = rtsTrue;
+ }
+ IF_PAR_DEBUG(verbose,
+ belch("-qh<n>: thunks per packet set to %d",
+ RtsFlags.ParFlags.thunksToPack));
+ break;
+
case 'P': /* -qP for writing a log file */
- RtsFlags.ParFlags.ParStats.Full = rtsTrue;
+ //RtsFlags.ParFlags.ParStats.Full = rtsFalse;
/* same encoding as in GranSim after -bP */
switch(rts_argv[arg][3]) {
- case '\0': break; // nothing special, just an ordinary profile
- //case '0': RtsFlags.ParFlags.ParStats.Suppressed = rtsTrue;
- // break;
+ case '\0': RtsFlags.ParFlags.ParStats.Full = rtsTrue;
+ break; // nothing special, just an ordinary profile
+ case '0': RtsFlags.ParFlags.ParStats.Suppressed = rtsTrue;
+ RtsFlags.ParFlags.ParStats.Full = rtsFalse;
+ break;
case 'b': RtsFlags.ParFlags.ParStats.Binary = rtsTrue;
break;
case 's': RtsFlags.ParFlags.ParStats.Sparks = rtsTrue;
// break;
case 'n': RtsFlags.ParFlags.ParStats.NewLogfile = rtsTrue;
break;
- case 'g': RtsFlags.ParFlags.ParStats.Global = rtsTrue;
+ case 'g':
+# if defined(PAR_TICKY)
+ RtsFlags.ParFlags.ParStats.Global = rtsTrue;
+# else
+ fprintf(stderr,"-qPg is only possible for a PAR_TICKY RTS, which this is not");
+ stg_exit(EXIT_FAILURE);
+# endif
break;
default: barf("Unknown option -qP%c", rts_argv[arg][2]);
}
if (rts_argv[arg][3] != '\0') {
RtsFlags.ParFlags.packBufferSize = decode(rts_argv[arg]+3);
} else {
- belch("setupRtsFlags: missing size of PackBuffer (for -Q)\n");
- error = rtsTrue;
+ belch("setupRtsFlags: missing size of PackBuffer (for -qQ)\n");
+ *error = rtsTrue;
}
IF_PAR_DEBUG(verbose,
belch("-qQ<n>: pack buffer size set to %d",
RtsFlags.ParFlags.packBufferSize));
break;
+ case 'R':
+ RtsFlags.ParFlags.doFairScheduling = rtsTrue;
+ IF_PAR_DEBUG(verbose,
+ belch("-qR: fair-ish scheduling"));
+ break;
+
# if defined(DEBUG)
case 'w':
if (rts_argv[arg][3] != '\0') {
break;
# endif
default:
- belch("Unknown option -q%c", rts_argv[arg][2]);
+ belch("Unknown option -q%c (%d opts in total)",
+ rts_argv[arg][2], *rts_argc);
break;
} /* switch */
}
fprintf(stderr, par_debug_opts_strs[i]);
switch (i) {
case 0: RtsFlags.ParFlags.Debug.verbose = rtsTrue; break;
- case 1: RtsFlags.ParFlags.Debug.trace = rtsTrue; break;
+ case 1: RtsFlags.ParFlags.Debug.bq = rtsTrue; break;
case 2: RtsFlags.ParFlags.Debug.schedule = rtsTrue; break;
case 3: RtsFlags.ParFlags.Debug.free = rtsTrue; break;
case 4: RtsFlags.ParFlags.Debug.resume = rtsTrue; break;
case 5: RtsFlags.ParFlags.Debug.weight = rtsTrue; break;
case 6: RtsFlags.ParFlags.Debug.fetch = rtsTrue; break;
- case 7: RtsFlags.ParFlags.Debug.ack = rtsTrue; break;
- case 8: RtsFlags.ParFlags.Debug.fish = rtsTrue; break;
- case 9: RtsFlags.ParFlags.Debug.forward = rtsTrue; break;
- case 10: RtsFlags.ParFlags.Debug.pack = rtsTrue; break;
- default: barf("set_par_debug_options: only %d debug options expected");
+ //case 7: RtsFlags.ParFlags.Debug.ack = rtsTrue; break;
+ case 7: RtsFlags.ParFlags.Debug.fish = rtsTrue; break;
+ case 8: RtsFlags.ParFlags.Debug.tables = rtsTrue; break;
+ case 9: RtsFlags.ParFlags.Debug.packet = rtsTrue; break;
+ case 10: RtsFlags.ParFlags.Debug.pack = rtsTrue; break;
+ case 11: RtsFlags.ParFlags.Debug.paranoia = rtsTrue; break;
+ default: barf("set_par_debug_options: only %d debug options expected",
+ MAX_PAR_DEBUG_OPTION);
} /* switch */
} /* if */
}
fprintf(stderr, par_debug_opts_strs[i]);
}
-#endif /* GRAN */
+#endif /* PAR */
//@node Aux fcts, , GranSim specific options
//@subsection Aux fcts