X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.c;h=b6d210f749b2ec6da456730217387289e79ddaea;hb=6c42179eb1c7e0643485f99b4b6e24b213c1fa90;hp=01b2ec070354094c3955cfc0b98efa703da43ec3;hpb=9ac55e08e159d7a4647ab01e7872e69dd762f275;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index 01b2ec0..b6d210f 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.c,v 1.34 2000/12/04 12:31:21 simonmar Exp $ + * $Id: RtsFlags.c,v 1.37 2001/03/14 11:18:18 sewardj Exp $ * * (c) The AQUA Project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -238,10 +238,14 @@ void initRtsFlagsDefaults(void) #endif /* PROFILING or PAR */ #ifdef PROFILING - RtsFlags.ProfFlags.doHeapProfile = rtsFalse; + RtsFlags.ProfFlags.doHeapProfile = rtsFalse; RtsFlags.ProfFlags.showCCSOnException = rtsFalse; + RtsFlags.ProfFlags.modSelector = NULL; + RtsFlags.ProfFlags.descrSelector = NULL; + RtsFlags.ProfFlags.typeSelector = NULL; + RtsFlags.ProfFlags.ccSelector = NULL; #elif defined(DEBUG) - RtsFlags.ProfFlags.doHeapProfile = rtsFalse; + RtsFlags.ProfFlags.doHeapProfile = rtsFalse; #endif RtsFlags.ConcFlags.ctxtSwitchTime = CS_MIN_MILLISECS; /* In milliseconds */ @@ -367,8 +371,10 @@ 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 @@ -381,13 +387,19 @@ usage_text[] = { " -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 More detailed Time/Allocation profile" +" -P More detailed Time/Allocation profile", + # if defined(PROFILING) "", " -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", +" A subset of closures may be selected thusly:", +" -hc{cc, cc ...} specific cost centre(s) (NOT STACKS!)", +" -hm{mod,mod...} all cost centres from the specified modules(s)", +" -hd{des,des...} closures with specified closure descriptions", +" -hy{typ,typ...} closures with specified type descriptions", "", " -xc Show current cost centre stack on raising an exception", # endif @@ -668,22 +680,30 @@ error = rtsTrue; #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; @@ -737,11 +757,44 @@ error = rtsTrue; case TYPEchar: RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_TYPE; break; + case 'c': /* cost centre label select */ + case 'm': /* cost centre module select */ + case 'd': /* closure descr select */ + case 'y': /* closure type select */ + {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\n %s\n", + rts_argv[arg]); + error = rtsTrue; + } else { + *right = '\0'; + switch (rts_argv[arg][2]) { + 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; + } + } + } + break; default: prog_belch("invalid heap profile option: %s",rts_argv[arg]); error = rtsTrue; } ) + #endif break;