X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.c;h=f8b8e994284d8a7d04283c2aa6086f3963c57e04;hb=f33938a37e973057d93d2fd625cc9e205e5cad03;hp=bb0088c8b9278cc5476e656f1dae28b46fbff851;hpb=dd4c28a9c706cce09ecc2c6f532969efa925532f;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index bb0088c..f8b8e99 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.c,v 1.28 2000/03/31 03:09:36 hwloidl Exp $ + * $Id: RtsFlags.c,v 1.36 2001/01/24 15:41:30 simonmar Exp $ * * (c) The AQUA Project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -25,18 +25,15 @@ #include "RtsFlags.h" #include "RtsUtils.h" #include "BlockAlloc.h" -#include "ProfRts.h" +#include "Itimer.h" /* CS_MIN_MILLISECS */ +#include "Profiling.h" #if defined(PROFILING) #include "Itimer.h" #endif -#if HAVE_STDLIB_H -#include -#endif - -#ifdef HAVE_STRING_H -#include +#ifdef HAVE_CTYPE_H +#include #endif extern struct RTS_FLAGS RtsFlags; @@ -70,7 +67,8 @@ char *debug_opts_strs[] = { "DEBUG (-D256): stable\n", "DEBUG (-D512): prof\n", "DEBUG (-D1024): gran\n", - "DEBUG (-D2048): par\n" + "DEBUG (-D2048): par\n", + "DEBUG (-D4096): linker\n" }; char *debug_opts_prefix[] = { @@ -86,6 +84,7 @@ char *debug_opts_prefix[] = { "_!", /* prof */ "_=", /* gran */ "_=" /* par */ + "_*" /* linker */ }; #if defined(GRAN) @@ -200,8 +199,10 @@ static void process_par_option(int arg, int *rts_argc, char *rts_argv[], rtsBool static void set_par_debug_options(nat n); static void help_par_debug_options(nat n); #endif +#if defined(DEBUG) static void set_debug_options(nat n); static void help_debug_options(nat n); +#endif //@node Command-line option parsing routines, GranSim specific options, Static function decls //@subsection Command-line option parsing routines @@ -227,11 +228,10 @@ void initRtsFlagsDefaults(void) 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; +#ifdef RTS_GTK_FRONTPANEL + RtsFlags.GcFlags.frontpanel = rtsFalse; +#endif #if defined(PROFILING) || defined(PAR) RtsFlags.CcFlags.doCostCentres = 0; @@ -240,12 +240,6 @@ void initRtsFlagsDefaults(void) #ifdef PROFILING RtsFlags.ProfFlags.doHeapProfile = rtsFalse; RtsFlags.ProfFlags.showCCSOnException = rtsFalse; - - 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; #endif @@ -278,7 +272,6 @@ void initRtsFlagsDefaults(void) #if defined(GRAN) /* ToDo: check defaults for GranSim and GUM */ - RtsFlags.ConcFlags.ctxtSwitchTime = CS_MIN_MILLISECS; /* In milliseconds */ RtsFlags.GcFlags.maxStkSize = (1024 * 1024) / sizeof(W_); RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_); @@ -363,7 +356,7 @@ usage_text[] = { "", "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 Sets the maximum stack size (default 1M) Egs: -K32k -K512k", " -k Sets the initial thread stack size (default 1k) Egs: -K4k -K2m", @@ -374,45 +367,32 @@ 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)", -" -s Summary GC statistics (default file: .stat)", -" -S Detailed GC statistics (with -Sstderr going to stderr)", +"", +" -t One-line GC statistics (default file: .stat)", +" -s Summary GC statistics (with -Sstderr going to stderr)", +" -S 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 Produce cost centre time profile (output file .prof)", +" -px Time/allocation profile (XML) (output file .prof)", +" -p Time/allocation profile (output file .prof)", " sort: T = time (default), A = alloc, C = cost centre label", -" -P Produce serial time profile (output file .time)", -" and a -p profile with detailed tick/alloc info", +" -P More detailed Time/Allocation profile" # if defined(PROFILING) "", -" -h Heap residency profile (output file .hp)", +" -hx Heap residency profile (XML) (output file .prof)", +" -h Heap residency profile (text) (output file .prof)", " break-down: C = cost centre stack (default), M = module", " D = closure description, Y = type description", -" T, = 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 closures which survived 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", "", " -xc Show current cost centre stack on raising an exception", # endif -"", -" -z set hash table for (C, M, G, D or Y)", -"", -" -i Number of seconds in a profiling interval (default 1.0):", -" heap profile (-h) and/or serial time profile (-P) frequency", #endif /* PROFILING or PAR */ #if !defined(PROFILING) && defined(DEBUG) "", @@ -432,7 +412,7 @@ usage_text[] = { #endif " -C 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(SMP) " -N Use OS threads (default: 1)", #endif @@ -594,7 +574,6 @@ error = rtsTrue; /* =========== GENERAL ========================== */ case '?': - case 'f': error = rtsTrue; break; @@ -684,31 +663,37 @@ error = rtsTrue; } 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.GcFlags.statsFile = stderr; /* temporary; ToDo: rm */ + /* Opening all those files would almost certainly fail... */ + 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; @@ -732,13 +717,6 @@ error = rtsTrue; } ) 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 'h': /* serial heap profile */ #if !defined(PROFILING) && defined(DEBUG) switch (rts_argv[arg][2]) { @@ -769,22 +747,6 @@ error = rtsTrue; 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)); - } - } - break; default: prog_belch("invalid heap profile option: %s",rts_argv[arg]); error = rtsTrue; @@ -793,81 +755,6 @@ 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]); - error = rtsTrue; - } - 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; - } - break; - default: - prog_belch("invalid index table size option: %s", - rts_argv[arg]); - error = rtsTrue; - } - ) 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; - } 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; - /* =========== CONCURRENT ========================= */ case 'C': /* context switch interval */ if (rts_argv[arg][2] == '\0') @@ -878,7 +765,7 @@ error = rtsTrue; /* 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; @@ -1909,8 +1796,9 @@ help_par_debug_options(nat n) { fprintf(stderr, par_debug_opts_strs[i]); } -#endif /* GRAN */ +#endif /* PAR */ +#ifdef DEBUG static void set_debug_options(nat n) { nat i; @@ -1919,18 +1807,19 @@ set_debug_options(nat n) { if ((n>>i)&1) { fprintf(stderr, debug_opts_strs[i]); switch (i) { - case 0: RtsFlags.DebugFlags.scheduler = rtsTrue; break; - case 1: RtsFlags.DebugFlags.evaluator = rtsTrue; break; - case 2: RtsFlags.DebugFlags.codegen = rtsTrue; break; - case 3: RtsFlags.DebugFlags.weak = rtsTrue; break; - case 4: RtsFlags.DebugFlags.gccafs = rtsTrue; break; - case 5: RtsFlags.DebugFlags.gc = rtsTrue; break; - case 6: RtsFlags.DebugFlags.block_alloc = rtsTrue; break; - case 7: RtsFlags.DebugFlags.sanity = rtsTrue; break; - case 8: RtsFlags.DebugFlags.stable = rtsTrue; break; - case 9: RtsFlags.DebugFlags.prof = rtsTrue; break; - case 10: RtsFlags.DebugFlags.gran = rtsTrue; break; - case 11: RtsFlags.DebugFlags.par = rtsTrue; break; + case 0: RtsFlags.DebugFlags.scheduler = rtsTrue; break; + case 1: RtsFlags.DebugFlags.evaluator = rtsTrue; break; + case 2: RtsFlags.DebugFlags.codegen = rtsTrue; break; + case 3: RtsFlags.DebugFlags.weak = rtsTrue; break; + case 4: RtsFlags.DebugFlags.gccafs = rtsTrue; break; + case 5: RtsFlags.DebugFlags.gc = rtsTrue; break; + case 6: RtsFlags.DebugFlags.block_alloc = rtsTrue; break; + case 7: RtsFlags.DebugFlags.sanity = rtsTrue; break; + case 8: RtsFlags.DebugFlags.stable = rtsTrue; break; + case 9: RtsFlags.DebugFlags.prof = rtsTrue; break; + case 10: RtsFlags.DebugFlags.gran = rtsTrue; break; + case 11: RtsFlags.DebugFlags.par = rtsTrue; break; + case 12: RtsFlags.DebugFlags.linker = rtsTrue; break; } /* switch */ } /* if */ } @@ -1943,6 +1832,7 @@ help_debug_options(nat n) { if ((n>>i)&1) fprintf(stderr, debug_opts_strs[i]); } +#endif /* DEBUG */ //@node Aux fcts, , GranSim specific options //@subsection Aux fcts