#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
-#include "BlockAlloc.h"
#include "Profiling.h"
#ifdef HAVE_CTYPE_H
#endif
RtsFlags.GcFlags.idleGCDelayTime = 300; /* millisecs */
+#if osf3_HOST_OS
+/* ToDo: Perhaps by adjusting this value we can make linking without
+ * -static work (i.e., not generate a core-dumping executable)? */
+# if SIZEOF_VOID_P == 8
+ RtsFlags.GcFlags.heapBase = 0x180000000L;
+# else
+# error I have no idea where to begin the heap on a non-64-bit osf3 machine.
+# endif
+#else
+ RtsFlags.GcFlags.heapBase = 0; /* means don't care */
+#endif
+
#ifdef DEBUG
RtsFlags.DebugFlags.scheduler = rtsFalse;
RtsFlags.DebugFlags.interpreter = rtsFalse;
RtsFlags.DebugFlags.par = rtsFalse;
RtsFlags.DebugFlags.linker = rtsFalse;
RtsFlags.DebugFlags.squeeze = rtsFalse;
+ RtsFlags.DebugFlags.hpc = rtsFalse;
#endif
#if defined(PROFILING) || defined(PAR)
RtsFlags.CcFlags.doCostCentres = 0;
#endif /* PROFILING or PAR */
-#ifdef PROFILING
RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
RtsFlags.ProfFlags.profileInterval = 100;
+
+#ifdef PROFILING
RtsFlags.ProfFlags.includeTSOs = rtsFalse;
RtsFlags.ProfFlags.showCCSOnException = rtsFalse;
RtsFlags.ProfFlags.maxRetainerSetSize = 8;
+ RtsFlags.ProfFlags.ccsLength = 25;
RtsFlags.ProfFlags.modSelector = NULL;
RtsFlags.ProfFlags.descrSelector = NULL;
RtsFlags.ProfFlags.typeSelector = NULL;
RtsFlags.ProfFlags.ccsSelector = NULL;
RtsFlags.ProfFlags.retainerSelector = NULL;
RtsFlags.ProfFlags.bioSelector = NULL;
-
-#elif defined(DEBUG)
- RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
#endif
RtsFlags.MiscFlags.tickInterval = 50; /* In milliseconds */
RtsFlags.ConcFlags.ctxtSwitchTime = 50; /* In milliseconds */
+ RtsFlags.MiscFlags.install_signal_handlers = rtsTrue;
+
#ifdef THREADED_RTS
RtsFlags.ParFlags.nNodes = 1;
RtsFlags.ParFlags.migrate = rtsTrue;
RtsFlags.TraceFlags.timestamp = rtsFalse;
RtsFlags.TraceFlags.sched = rtsFalse;
+
+#ifdef USE_PAPI
+ /* By default no special measurements taken */
+ RtsFlags.PapiFlags.eventType = 0;
+#endif
}
static const char *
" -hb<bio>... closures with specified biographies (lag,drag,void,use)",
"",
" -R<size> Set the maximum retainer set size (default: 8)",
-"",
-" -i<sec> Time between heap samples (seconds, default: 0.1)",
+"",
+" -L<chars> Maximum length of a cost-centre stack in a heap profile",
+" (default: 25)",
"",
" -xt Include threads (TSOs) in a heap profile",
"",
" -xc Show current cost centre stack on raising an exception",
+"",
# endif
#endif /* PROFILING or PAR */
-#if !defined(PROFILING) && defined(DEBUG)
+#if !defined(PROFILING)
"",
-" -h<break-down> Debugging Heap residency profile",
-" (output file <program>.hp)",
-" break-down: L = closure label (default)",
-" T = closure type (constructor, thunk etc.)",
+" -hT Heap residency profile (output file <program>.hp)",
#endif
+" -i<sec> Time between heap samples (seconds, default: 0.1)",
"",
#if defined(TICKY_TICKY)
-" -r<file> Produce reduction profiling statistics (with -rstderr for stderr)",
+" -r<file> Produce ticky-ticky statistics (with -rstderr for stderr)",
"",
#endif
#if defined(PAR)
" -N<n> Use <n> PVMish processors in parallel (default: 2)",
/* NB: the -N<n> is implemented by the driver!! */
#endif
-" -C<secs> Context-switch interval in seconds",
-" (0 or no argument means switch as often as possible)",
-" the default is .02 sec; resolution is .02 sec",
+" -C<secs> Context-switch interval in seconds.",
+" 0 or no argument means switch as often as possible.",
+" Default: 0.02 sec; resolution is set by -V below.",
+" -V<secs> Master tick interval in seconds (0 == disable timer).",
+" 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",
" -Dl DEBUG: linker",
" -Dm DEBUG: stm",
" -Dz DEBUG: stack squezing",
+" -Dc DEBUG: program coverage",
"",
#endif /* DEBUG */
#if defined(THREADED_RTS) && !defined(NOSMP)
" -qm Don't automatically migrate threads between CPUs",
" -qw Migrate a thread to the current CPU when it is woken up",
#endif
+" --install-signal-handlers=<yes|no>",
+" Install signal handlers (default: yes)",
#if defined(THREADED_RTS) || defined(PAR)
" -e<size> Size of spark pools (default 100)",
#endif
#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(USE_PAPI)
+" -aX CPU performance counter measurements using PAPI",
+" (use with the -s<file> option). X is one of:",
+"",
+/* " y - cycles", */
+" 1 - level 1 cache misses",
+" 2 - level 2 cache misses",
+" b - branch mispredictions",
+" s - stalled cycles",
+" e - cache miss and branch misprediction events",
+#endif
"",
"RTS options may also be specified using the GHCRTS environment variable.",
"",
error = rtsTrue;
break;
+ /* This isn't going to allow us to keep related options
+ together as we add more --* flags. We really need a
+ proper options parser. */
+ case '-':
+ if (strequal("install-signal-handlers=yes",
+ &rts_argv[arg][2])) {
+ RtsFlags.MiscFlags.install_signal_handlers = rtsTrue;
+ }
+ else if (strequal("install-signal-handlers=no",
+ &rts_argv[arg][2])) {
+ RtsFlags.MiscFlags.install_signal_handlers = rtsFalse;
+ }
+ else {
+ errorBelch("unknown RTS option: %s",rts_argv[arg]);
+ error = rtsTrue;
+ }
+ break;
case 'A':
RtsFlags.GcFlags.minAllocAreaSize
= decode(rts_argv[arg]+2) / BLOCK_SIZE;
}
break;
+#ifdef USE_PAPI
+ case 'a':
+ switch(rts_argv[arg][2]) {
+ case '1':
+ RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L1;
+ break;
+ case '2':
+ RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L2;
+ break;
+ case 'b':
+ RtsFlags.PapiFlags.eventType = PAPI_FLAG_BRANCH;
+ break;
+ case 's':
+ RtsFlags.PapiFlags.eventType = PAPI_FLAG_STALLS;
+ break;
+ case 'e':
+ RtsFlags.PapiFlags.eventType = PAPI_FLAG_CB_EVENTS;
+ break;
+ default:
+ bad_option( rts_argv[arg] );
+ }
+ break;
+#endif
+
case 'B':
RtsFlags.GcFlags.ringBell = rtsTrue;
break;
case 'z':
RtsFlags.DebugFlags.squeeze = rtsTrue;
break;
+ case 'c':
+ RtsFlags.DebugFlags.hpc = rtsTrue;
+ break;
default:
bad_option( rts_argv[arg] );
}
PROFILING_BUILD_ONLY(
RtsFlags.ProfFlags.maxRetainerSetSize = atof(rts_argv[arg]+2);
) break;
-
+ case 'L':
+ PROFILING_BUILD_ONLY(
+ RtsFlags.ProfFlags.ccsLength = atof(rts_argv[arg]+2);
+ if(RtsFlags.ProfFlags.ccsLength <= 0) {
+ bad_option(rts_argv[arg]);
+ }
+ ) break;
case 'h': /* serial heap profile */
-#if !defined(PROFILING) && defined(DEBUG)
+#if !defined(PROFILING)
switch (rts_argv[arg][2]) {
case '\0':
- case 'L':
- RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_INFOPTR;
- break;
case 'T':
RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_CLOSURE_TYPE;
break;
#endif /* PROFILING */
break;
-#if defined(PROFILING)
case 'i': /* heap sample interval */
if (rts_argv[arg][2] == '\0') {
/* use default */
RtsFlags.ProfFlags.profileInterval = cst;
}
break;
-#endif
/* =========== CONCURRENT ========================= */
case 'C': /* context switch interval */
error = rtsTrue;
break;
+ case 'b': /* heapBase in hex; undocumented */
+ if (rts_argv[arg][3] != '\0') {
+ RtsFlags.GcFlags.heapBase
+ = strtol(rts_argv[arg]+3, (char **) NULL, 16);
+ } else {
+ errorBelch("-xb: requires argument");
+ error = rtsTrue;
+ }
+ break;
+
case 'c': /* Debugging tool: show current cost centre on an exception */
PROFILING_BUILD_ONLY(
RtsFlags.ProfFlags.showCCSOnException = rtsTrue;
}
}
- // Determine what tick interval we should use for the RTS timer
- // by taking the shortest of the various intervals that we need to
- // monitor.
- if (RtsFlags.MiscFlags.tickInterval <= 0) {
+ if (RtsFlags.MiscFlags.tickInterval < 0) {
RtsFlags.MiscFlags.tickInterval = 50;
}
+ // If the master timer is disabled, turn off the other timers.
+ if (RtsFlags.MiscFlags.tickInterval == 0) {
+ RtsFlags.ConcFlags.ctxtSwitchTime = 0;
+ RtsFlags.GcFlags.idleGCDelayTime = 0;
+ RtsFlags.ProfFlags.profileInterval = 0;
+ }
+
+ // Determine what tick interval we should use for the RTS timer
+ // by taking the shortest of the various intervals that we need to
+ // monitor.
if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
RtsFlags.MiscFlags.tickInterval =
stg_min(RtsFlags.ConcFlags.ctxtSwitchTime,
RtsFlags.MiscFlags.tickInterval);
}
-#ifdef PROFILING
if (RtsFlags.ProfFlags.profileInterval > 0) {
RtsFlags.MiscFlags.tickInterval =
stg_min(RtsFlags.ProfFlags.profileInterval,
RtsFlags.MiscFlags.tickInterval);
}
-#endif
if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
RtsFlags.ConcFlags.ctxtSwitchTicks =
RtsFlags.ConcFlags.ctxtSwitchTicks = 0;
}
-#ifdef PROFILING
- RtsFlags.ProfFlags.profileIntervalTicks =
- RtsFlags.ProfFlags.profileInterval / RtsFlags.MiscFlags.tickInterval;
-#endif
+ if (RtsFlags.ProfFlags.profileInterval > 0) {
+ RtsFlags.ProfFlags.profileIntervalTicks =
+ RtsFlags.ProfFlags.profileInterval /
+ RtsFlags.MiscFlags.tickInterval;
+ } else {
+ RtsFlags.ProfFlags.profileIntervalTicks = 0;
+ }
if (error) {
const char **p;