rts_ccs_length
authorRavi Nanavati <ravi@bluespec.com>
Fri, 29 Sep 2006 22:51:15 +0000 (22:51 +0000)
committerRavi Nanavati <ravi@bluespec.com>
Fri, 29 Sep 2006 22:51:15 +0000 (22:51 +0000)
Add the -L RTS flag to control the length of the cost-centre stacks reported in
a heap profile.

Please include this change in the 6.6 branch as well as HEAD

includes/RtsFlags.h
rts/ProfHeap.c
rts/RtsFlags.c

index fbdc64e..6c4b230 100644 (file)
@@ -97,6 +97,8 @@ struct PROFILING_FLAGS {
 
     nat                 maxRetainerSetSize;
 
+    nat                 ccsLength;
+
     char*               modSelector;
     char*               descrSelector;
     char*               typeSelector;
index 2818fb6..0ee53f3 100644 (file)
@@ -806,7 +806,7 @@ dumpCensus( Census *census )
 #ifdef PROFILING
        switch (RtsFlags.ProfFlags.doHeapProfile) {
        case HEAP_BY_CCS:
-           fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, 25);
+           fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, RtsFlags.ProfFlags.ccsLength);
            break;
        case HEAP_BY_MOD:
        case HEAP_BY_DESCR:
index 9aa906f..7b8a4d1 100644 (file)
@@ -177,6 +177,7 @@ void initRtsFlagsDefaults(void)
     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;
@@ -369,6 +370,9 @@ usage_text[] = {
 "    -hb<bio>...  closures with specified biographies (lag,drag,void,use)",
 "",
 "  -R<size>       Set the maximum retainer set size (default: 8)",
+"", 
+"  -L<chars>      Maximum length of a cost-centre stack in a heap profile",
+"                 (default: 25)",
 "",
 "  -i<sec>        Time between heap samples (seconds, default: 0.1)",
 "",
@@ -858,7 +862,13 @@ error = rtsTrue;
                  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)
                switch (rts_argv[arg][2]) {