eventlog: Clean up profiling heap breakdown type
authorBen Gamari <bgamari.foss@gmail.com>
Mon, 4 Sep 2017 12:14:38 +0000 (08:14 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 5 Sep 2017 11:20:01 +0000 (07:20 -0400)
Reviewers: austin, erikd, simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #14096

Differential Revision: https://phabricator.haskell.org/D3923

docs/users_guide/eventlog-formats.rst
docs/users_guide/profiling.rst
includes/rts/EventLogFormat.h
rts/eventlog/EventLog.c

index 8b1427d..9910d4d 100644 (file)
@@ -33,12 +33,13 @@ A single fixed-width event emitted during program start-up describing the sample
    * ``Word64``: Sampling period in nanoseconds
    * ``Word32``: Sample break-down type. One of,
 
-      * ``SAMPLE_TYPE_COST_CENTER`` (output from ``-hc``)
-      * ``SAMPLE_TYPE_CLOSURE_DESCR`` (output from ``-hd``)
-      * ``SAMPLE_TYPE_RETAINER`` (output from ``-hr``)
-      * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``)
-      * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``)
-      * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``)
+      * ``HEAP_PROF_BREAKDOWN_COST_CENTER`` (output from :rts-flag:`-hc`)
+      * ``HEAP_PROF_BREAKDOWN_CLOSURE_DESCR`` (output from :rts-flag:`-hd`)
+      * ``HEAP_PROF_BREAKDOWN_RETAINER`` (output from :rts-flag:`-hr`)
+      * ``HEAP_PROF_BREAKDOWN_MODULE`` (output from :rts-flag:`-hm`)
+      * ``HEAP_PROF_BREAKDOWN_TYPE_DESCR`` (output from :rts-flag:`-hy`)
+      * ``HEAP_PROF_BREAKDOWN_BIOGRAPHY`` (output from :rts-flag:`-hb`)
+      * ``HEAP_PROF_BREAKDOWN_CLOSURE_TYPE`` (output from :rts-flag:`-hT`)
 
    * ``String``: Module filter
    * ``String``: Closure description filter
index ded6675..589fbdb 100644 (file)
@@ -690,35 +690,36 @@ following RTS options select which break-down to use:
 .. rts-flag:: -hc
               -h
 
-    (can be shortened to :rts-flag:`-h`). Breaks down the graph by the
-    cost-centre stack which produced the data.
+    *Requires :ghc-flag:`-prof`.* Breaks down the graph by the cost-centre stack
+    which produced the data.
 
 .. rts-flag:: -hm
 
-    Break down the live heap by the module containing the code which
-    produced the data.
+    *Requires :ghc-flag:`-prof`.* Break down the live heap by the module
+    containing the code which produced the data.
 
 .. rts-flag:: -hd
 
-    Breaks down the graph by closure description. For actual data, the
-    description is just the constructor name, for other closures it is a
-    compiler-generated string identifying the closure.
+    *Requires :ghc-flag:`-prof`.* Breaks down the graph by closure description.
+    For actual data, the description is just the constructor name, for other
+    closures it is a compiler-generated string identifying the closure.
 
 .. rts-flag:: -hy
 
-    Breaks down the graph by type. For closures which have function type
-    or unknown/polymorphic type, the string will represent an
-    approximation to the actual type.
+    *Requires :ghc-flag:`-prof`.* Breaks down the graph by type. For closures
+    which have function type or unknown/polymorphic type, the string will
+    represent an approximation to the actual type.
 
 .. rts-flag:: -hr
 
-    Break down the graph by retainer set. Retainer profiling is
-    described in more detail below (:ref:`retainer-prof`).
+    *Requires :ghc-flag:`-prof`.* Break down the graph by retainer set. Retainer
+    profiling is described in more detail below (:ref:`retainer-prof`).
 
 .. rts-flag:: -hb
 
-    Break down the graph by biography. Biographical profiling is
-    described in more detail below (:ref:`biography-prof`).
+    *Requires :ghc-flag:`-prof`.* Break down the graph by biography.
+    Biographical profiling is described in more detail below
+    (:ref:`biography-prof`).
 
 .. rts-flag:: -l
 
index f839be0..d7b465a 100644 (file)
 #define CAPSET_TYPE_OSPROCESS   2  /* caps belong to the same OS process */
 #define CAPSET_TYPE_CLOCKDOMAIN 3  /* caps share a local clock/time      */
 
+/*
+ * Heap profile breakdown types. See EVENT_HEAP_PROF_BEGIN.
+ */
+typedef enum {
+    HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1,
+    HEAP_PROF_BREAKDOWN_MODULE,
+    HEAP_PROF_BREAKDOWN_CLOSURE_DESCR,
+    HEAP_PROF_BREAKDOWN_TYPE_DESCR,
+    HEAP_PROF_BREAKDOWN_RETAINER,
+    HEAP_PROF_BREAKDOWN_BIOGRAPHY,
+} HeapProfBreakdown;
+
 #if !defined(EVENTLOG_CONSTANTS_ONLY)
 
 typedef StgWord16 EventTypeNum;
index ed297b8..c8b4485 100644 (file)
@@ -1094,15 +1094,6 @@ void postBlockMarker (EventsBuf *eb)
     postCapNo(eb, eb->capno);
 }
 
-typedef enum {
-    HEAP_PROF_BREAKDOWN_COST_CENTRE = 0x1,
-    HEAP_PROF_BREAKDOWN_MODULE,
-    HEAP_PROF_BREAKDOWN_CLOSURE_DESCR,
-    HEAP_PROF_BREAKDOWN_TYPE_DESCR,
-    HEAP_PROF_BREAKDOWN_RETAINER,
-    HEAP_PROF_BREAKDOWN_BIOGRAPHY,
-} HeapProfBreakdown;
-
 static HeapProfBreakdown getHeapProfBreakdown(void)
 {
     switch (RtsFlags.ProfFlags.doHeapProfile) {