[project @ 2003-01-29 09:54:31 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsFlags.c
index b11f152..789d73d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.62 2002/12/11 15:36:47 simonmar Exp $
+ * $Id: RtsFlags.c,v 1.65 2003/01/28 16:23:53 simonmar Exp $
  *
  * (c) The AQUA Project, Glasgow University, 1994-1997
  * (c) The GHC Team, 1998-1999
@@ -45,9 +45,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
@@ -250,6 +250,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 +439,8 @@ usage_text[] = {
 "",
 "  -i<sec>        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 */
@@ -569,7 +572,7 @@ setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[])
        }
     }
 
-    // process arguments from the GHCRTS environment variable first
+    // process arguments from the GHCRTS environment variable next
     // (arguments from the command line override these).
     {
        char *ghc_rts = getenv("GHCRTS");
@@ -1121,8 +1124,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. */