[commit: ghc] master: rts: Allow profiling by closure type in prof way (b7b6617)

git at git.haskell.org git at git.haskell.org
Tue May 1 20:04:43 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7b6617a90824303daf555c817f538cd9c792671/ghc

>---------------------------------------------------------------

commit b7b6617a90824303daf555c817f538cd9c792671
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue May 1 13:10:13 2018 -0400

    rts: Allow profiling by closure type in prof way
    
    Previously we inexplicably disabled support for `-hT` profiling in the profiled
    way. Admittedly, there are relatively few cases where one would prefer -hT to
    `-hd`, but the option should nevertheless be available for the sake of
    consistency.
    
    Note that this does mean that there is a bit of an inconsistency in the behavior
    of `-h`: in the profiled way `-h` behaves like `-hc` whereas in the non-profiled
    way it defaults to `-hT`.


>---------------------------------------------------------------

b7b6617a90824303daf555c817f538cd9c792671
 rts/ProfHeap.c | 5 +----
 rts/RtsFlags.c | 6 ++++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 4a7b6d3..55d22ff 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -127,8 +127,8 @@ closureIdentity( const StgClosure *p )
             return retainerSetOf(p);
         else
             return NULL;
+#endif
 
-#else
     case HEAP_BY_CLOSURE_TYPE:
     {
         const StgInfoTable *info;
@@ -147,7 +147,6 @@ closureIdentity( const StgClosure *p )
         }
     }
 
-#endif
     default:
         barf("closureIdentity");
     }
@@ -815,7 +814,6 @@ dumpCensus( Census *census )
 
         if (count == 0) continue;
 
-#if !defined(PROFILING)
         switch (RtsFlags.ProfFlags.doHeapProfile) {
         case HEAP_BY_CLOSURE_TYPE:
             fprintf(hp_file, "%s", (char *)ctr->identity);
@@ -823,7 +821,6 @@ dumpCensus( Census *census )
                                       count * sizeof(W_));
             break;
         }
-#endif
 
 #if defined(PROFILING)
         switch (RtsFlags.ProfFlags.doHeapProfile) {
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index eb226ed..461c416 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -343,10 +343,9 @@ usage_text[] = {
 "  -xt            Include threads (TSOs) in a heap profile",
 "",
 "  -xc      Show current cost centre stack on raising an exception",
-#else
+#endif /* PROFILING */
 "",
 "  -hT            Produce a heap profile grouped by closure type"
-#endif /* PROFILING */
 
 #if defined(TRACING)
 "",
@@ -1956,6 +1955,9 @@ static bool read_heap_profiling_flag(const char *arg)
         case 'b':
             RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_LDV;
             break;
+        case 'T':
+            RtsFlags.ProfFlags.doHeapProfile = HEAP_BY_CLOSURE_TYPE;
+            break;
         }
         break;
 



More information about the ghc-commits mailing list