X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.c;h=55effe2c4a8e9acf3617531c0c3db7480ea8e2f0;hb=90af5e7b48c2f0ec74891c1399d46781d078484a;hp=6caabafde1af14c43e02303efbcf92cf5243835c;hpb=af09c6afab1a24decafc76a467f10381d521bd22;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index 6caabaf..55effe2 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.c,v 1.63 2002/12/19 14:23:35 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 @@ -26,13 +26,9 @@ #include "RtsFlags.h" #include "RtsUtils.h" #include "BlockAlloc.h" -#include "Itimer.h" /* CS_MIN_MILLISECS */ +#include "Timer.h" /* CS_MIN_MILLISECS */ #include "Profiling.h" -#if defined(PROFILING) -#include "Itimer.h" -#endif - #ifdef HAVE_CTYPE_H #include #endif @@ -45,9 +41,9 @@ 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 @@ -59,25 +55,9 @@ char *rts_argv[MAX_RTS_ARGS]; #define RTS 1 #define PGM 0 -char *debug_opts_prefix[] = { - "_-", /* scheduler */ - "_.", /* interpreter */ - "_,", /* codegen */ - "_;", /* weak */ - "_~", /* gccafs */ - "_@", /* gc */ - "_#", /* block */ - "_&", /* sanity */ - "_:", /* stable */ - "_!", /* prof */ - "_=", /* gran */ - "_=" /* par */ - "_*" /* linker */ -}; - #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", @@ -96,32 +76,13 @@ char *gran_debug_opts_strs[] = { }; /* 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 (-qDq, -qD2): bq; print blocking queues.\n", "DEBUG (-qDs, -qD4): schedule; scheduling of parallel threads.\n", @@ -139,27 +100,10 @@ char *par_debug_opts_strs[] = { }; /* one character codes for the available debug options */ -char par_debug_opts_flags[] = { +static char par_debug_opts_flags[] = { 'v', 'q', 's', 'e', 'r', 'w', 'F', 'f', 'l', 'o', 'p', 'z' }; -/* prefix strings printed with the debug messages of the corresponding type */ -char *par_debug_opts_prefix[] = { - " ", /* verbose */ - "##", /* bq */ - "--", /* schedule */ - "!!", /* free */ - "[]", /* resume */ - ";;", /* weight */ - "%%", /* fetch */ - //",,", /* ack */ - "$$", /* fish */ - "", /* tables */ - "**", /* packet */ - "**" /* pack */ - ":(" /* paranoia */ -}; - #endif /* PAR */ //@node Static function decls, Command-line option parsing routines, Constants @@ -250,6 +194,7 @@ void initRtsFlagsDefaults(void) #ifdef PROFILING RtsFlags.ProfFlags.doHeapProfile = rtsFalse; RtsFlags.ProfFlags.profileInterval = 100; + RtsFlags.ProfFlags.includeTSOs = rtsFalse; RtsFlags.ProfFlags.showCCSOnException = rtsFalse; RtsFlags.ProfFlags.maxRetainerSetSize = 8; RtsFlags.ProfFlags.modSelector = NULL; @@ -438,6 +383,8 @@ usage_text[] = { "", " -i Time between heap samples (seconds, default: 0.1)", "", +" -xt Include threads (TSOs) in a heap profile", +"", " -xc Show current cost centre stack on raising an exception", # endif #endif /* PROFILING or PAR */ @@ -529,7 +476,7 @@ splitRtsFlags(char *s, int *rts_argc, char *rts_argv[]) if (c1 == c2) { break; } if (*rts_argc < MAX_RTS_ARGS-1) { - s = malloc(c2-c1+1); + s = stgMallocBytes(c2-c1+1, "RtsFlags.c:splitRtsFlags()"); strncpy(s, c1, c2-c1); s[c2-c1] = '\0'; rts_argv[(*rts_argc)++] = s; @@ -1121,8 +1068,15 @@ error = rtsTrue; 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. */