ghc-events 0.4.0.0 → 0.4.0.1
raw patch · 4 files changed
+226/−21 lines, 4 filesdep ~bytestringdep ~containersdep ~mtl
Dependency ranges changed: bytestring, containers, mtl
Files
- GHC/RTS/EventLogFormat.h +27/−10
- GHC/RTS/EventTypes.hs +39/−1
- GHC/RTS/Events.hs +146/−3
- ghc-events.cabal +14/−7
GHC/RTS/EventLogFormat.h view
@@ -3,16 +3,16 @@ * (c) The GHC Team, 2008-2009 * * Event log format- * + * * The log format is designed to be extensible: old tools should be * able to parse (but not necessarily understand all of) new versions * of the format, and new tools will be able to understand old log * files.- * + * * Each event has a specific format. If you add new events, give them * new numbers: we never re-use old event numbers. *- * - The format is endian-independent: all values are represented in + * - The format is endian-independent: all values are represented in * bigendian order. * * - The format is extensible:@@ -51,7 +51,7 @@ * Word8* -- extra info (for future extensions) * EVENT_ET_END *- * Event : + * Event : * Word16 -- event_type * Word64 -- time (nanosecs) * [Word16] -- length of the rest (for variable-sized events only)@@ -104,8 +104,7 @@ #define EVENT_STOP_THREAD 2 /* (thread, status, blockinfo) */ #define EVENT_THREAD_RUNNABLE 3 /* (thread) */ #define EVENT_MIGRATE_THREAD 4 /* (thread, new_cap) */-/* 5, 6 deprecated */-#define EVENT_SHUTDOWN 7 /* () */+/* 5, 6, 7 deprecated */ #define EVENT_THREAD_WAKEUP 8 /* (thread, other_cap) */ #define EVENT_GC_START 9 /* () */ #define EVENT_GC_END 10 /* () */@@ -114,6 +113,7 @@ /* 13, 14 deprecated */ #define EVENT_CREATE_SPARK_THREAD 15 /* (spark_thread) */ #define EVENT_LOG_MSG 16 /* (message ...) */+/* EVENT_STARTUP should be deprecated at some point */ #define EVENT_STARTUP 17 /* (num_capabilities) */ #define EVENT_BLOCK_MARKER 18 /* (size, end_time, capability) */ #define EVENT_USER_MSG 19 /* (message ...) */@@ -132,7 +132,7 @@ #define EVENT_PROGRAM_ENV 31 /* (capset, environment_vector) */ #define EVENT_OSPROCESS_PID 32 /* (capset, pid) */ #define EVENT_OSPROCESS_PPID 33 /* (capset, parent_pid) */-#define EVENT_SPARK_COUNTERS 34 /* (crt,dud,ovf,cnv,fiz,gcd,rem) */+#define EVENT_SPARK_COUNTERS 34 /* (crt,dud,ovf,cnv,gcd,fiz,rem) */ #define EVENT_SPARK_CREATE 35 /* () */ #define EVENT_SPARK_DUD 36 /* () */ #define EVENT_SPARK_OVERFLOW 37 /* () */@@ -140,11 +140,26 @@ #define EVENT_SPARK_STEAL 39 /* (victim_cap) */ #define EVENT_SPARK_FIZZLE 40 /* () */ #define EVENT_SPARK_GC 41 /* () */-#define EVENT_INTERN_STRING 42 /* (string, id) */+#define EVENT_INTERN_STRING 42 /* (string, id) {not used by ghc} */ #define EVENT_WALL_CLOCK_TIME 43 /* (capset, unix_epoch_seconds, nanoseconds) */ #define EVENT_THREAD_LABEL 44 /* (thread, name_string) */+#define EVENT_CAP_CREATE 45 /* (cap) */+#define EVENT_CAP_DELETE 46 /* (cap) */+#define EVENT_CAP_DISABLE 47 /* (cap) */+#define EVENT_CAP_ENABLE 48 /* (cap) */+#define EVENT_HEAP_ALLOCATED 49 /* (heap_capset, alloc_bytes) */+#define EVENT_HEAP_SIZE 50 /* (heap_capset, size_bytes) */+#define EVENT_HEAP_LIVE 51 /* (heap_capset, live_bytes) */+#define EVENT_HEAP_INFO_GHC 52 /* (heap_capset, n_generations,+ max_heap_size, alloc_area_size,+ mblock_size, block_size) */+#define EVENT_GC_STATS_GHC 53 /* (heap_capset, generation,+ copied_bytes, slop_bytes, frag_bytes,+ par_n_threads,+ par_max_copied, par_tot_copied) */+#define EVENT_GC_GLOBAL_SYNC 54 /* () */ -/* Range 45 - 59 is available for new GHC and common events */+/* Range 55 - 59 is available for new GHC and common events */ /* Range 60 - 80 is used by eden for parallel tracing * see http://www.mathematik.uni-marburg.de/~eden/@@ -157,7 +172,7 @@ * ranges higher than this are reserved but not currently emitted by ghc. * This must match the size of the EventDesc[] array in EventLog.c */-#define NUM_GHC_EVENT_TAGS 45+#define NUM_GHC_EVENT_TAGS 55 /* DEPRECATED EVENTS: */@@ -166,6 +181,8 @@ still need to parse them, see GHC.RTS.Events.ghc6Parsers for details. */ #define EVENT_RUN_SPARK 5 /* (thread) */ #define EVENT_STEAL_SPARK 6 /* (thread, victim_cap) */+/* shutdown replaced by EVENT_CAP_DELETE */+#define EVENT_SHUTDOWN 7 /* () */ #if 0 /* ghc changed how it handles sparks so these are no longer applicable */ #define EVENT_CREATE_SPARK 13 /* (cap, thread) */
GHC/RTS/EventTypes.hs view
@@ -109,6 +109,8 @@ -- init and shutdown | Startup { n_caps :: Int }+ -- EVENT_SHUTDOWN is replaced by EVENT_CAP_DELETE and GHC 7.6++ -- no longer generate the event; should be removed at some point | Shutdown { } -- thread scheduling@@ -154,7 +156,44 @@ | GCIdle { } | GCDone { } | EndGC { }+ | GlobalSyncGC { }+ | GCStatsGHC { heapCapset :: {-# UNPACK #-}!Capset+ , gen :: {-# UNPACK #-}!Int+ , copied :: {-# UNPACK #-}!Word64+ , slop, frag :: {-# UNPACK #-}!Word64+ , parNThreads :: {-# UNPACK #-}!Int+ , parMaxCopied :: {-# UNPACK #-}!Word64+ , parTotCopied :: {-# UNPACK #-}!Word64+ } + -- heap statistics+ | HeapAllocated { heapCapset :: {-# UNPACK #-}!Capset+ , allocBytes :: {-# UNPACK #-}!Word64+ }+ | HeapSize { heapCapset :: {-# UNPACK #-}!Capset+ , sizeBytes :: {-# UNPACK #-}!Word64+ }+ | HeapLive { heapCapset :: {-# UNPACK #-}!Capset+ , liveBytes :: {-# UNPACK #-}!Word64+ }+ | HeapInfoGHC { heapCapset :: {-# UNPACK #-}!Capset+ , gens :: {-# UNPACK #-}!Int+ , maxHeapSize :: {-# UNPACK #-}!Word64+ , allocAreaSize :: {-# UNPACK #-}!Word64+ , mblockSize :: {-# UNPACK #-}!Word64+ , blockSize :: {-# UNPACK #-}!Word64+ }++ -- adjusting the number of capabilities on the fly+ | CapCreate { cap :: {-# UNPACK #-}!Int+ }+ | CapDelete { cap :: {-# UNPACK #-}!Int+ }+ | CapDisable { cap :: {-# UNPACK #-}!Int+ }+ | CapEnable { cap :: {-# UNPACK #-}!Int+ }+ -- capability sets | CapsetCreate { capset :: {-# UNPACK #-}!Capset , capsetType :: CapsetType@@ -308,4 +347,3 @@ -- might be shared, in which case we could end up -- increasing the space usage. } deriving Show-
GHC/RTS/Events.hs view
@@ -139,6 +139,8 @@ Right es -> es } )), + -- EVENT_SHUTDOWN is replaced by EVENT_CAP_DELETE and GHC 7.6++ -- no longer generate the event; should be removed at some point (simpleEvent EVENT_SHUTDOWN Shutdown), (simpleEvent EVENT_REQUEST_SEQ_GC RequestSeqGC),@@ -155,6 +157,70 @@ (simpleEvent EVENT_GC_END EndGC), + (simpleEvent EVENT_GC_GLOBAL_SYNC GlobalSyncGC),++ (FixedSizeParser EVENT_GC_STATS_GHC (sz_capset + 2 + 5*8 + 4) (do -- (heap_capset, generation, copied_bytes, slop_bytes, frag_bytes, par_n_threads, par_max_copied, par_tot_copied)+ heapCapset <- getE+ gen <- getE :: GetEvents Word16+ copied <- getE :: GetEvents Word64+ slop <- getE :: GetEvents Word64+ frag <- getE :: GetEvents Word64+ parNThreads <- getE :: GetEvents Word32+ parMaxCopied <- getE :: GetEvents Word64+ parTotCopied <- getE :: GetEvents Word64+ return GCStatsGHC{ gen = fromIntegral gen+ , parNThreads = fromIntegral parNThreads+ , ..}+ )),++ (FixedSizeParser EVENT_HEAP_ALLOCATED (sz_capset + 8) (do -- (heap_capset, alloc_bytes)+ heapCapset <- getE+ allocBytes <- getE+ return HeapAllocated{..}+ )),++ (FixedSizeParser EVENT_HEAP_SIZE (sz_capset + 8) (do -- (heap_capset, size_bytes)+ heapCapset <- getE+ sizeBytes <- getE+ return HeapSize{..}+ )),++ (FixedSizeParser EVENT_HEAP_LIVE (sz_capset + 8) (do -- (heap_capset, live_bytes)+ heapCapset <- getE+ liveBytes <- getE+ return HeapLive{..}+ )),++ (FixedSizeParser EVENT_HEAP_INFO_GHC (sz_capset + 2 + 4*8) (do -- (heap_capset, n_generations, max_heap_size, alloc_area_size, mblock_size, block_size)+ heapCapset <- getE+ gens <- getE :: GetEvents Word16+ maxHeapSize <- getE :: GetEvents Word64+ allocAreaSize <- getE :: GetEvents Word64+ mblockSize <- getE :: GetEvents Word64+ blockSize <- getE :: GetEvents Word64+ return HeapInfoGHC{gens = fromIntegral gens, ..}+ )),++ (FixedSizeParser EVENT_CAP_CREATE (sz_cap) (do -- (cap)+ cap <- getE :: GetEvents CapNo+ return CapCreate{cap = fromIntegral cap}+ )),++ (FixedSizeParser EVENT_CAP_DELETE (sz_cap) (do -- (cap)+ cap <- getE :: GetEvents CapNo+ return CapDelete{cap = fromIntegral cap}+ )),++ (FixedSizeParser EVENT_CAP_DISABLE (sz_cap) (do -- (cap)+ cap <- getE :: GetEvents CapNo+ return CapDisable{cap = fromIntegral cap}+ )),++ (FixedSizeParser EVENT_CAP_ENABLE (sz_cap) (do -- (cap)+ cap <- getE :: GetEvents CapNo+ return CapEnable{cap = fromIntegral cap}+ )),+ (FixedSizeParser EVENT_CAPSET_CREATE (sz_capset + sz_capset_type) (do -- (capset, capset_type) cs <- getE ct <- fmap mkCapsetType getE@@ -313,16 +379,17 @@ return CreateSparkThread{sparkThread=st} )), - (FixedSizeParser EVENT_SPARK_COUNTERS (7*8) (do -- (crt,dud,ovf,cnv,fiz,gcd,rem)+ (FixedSizeParser EVENT_SPARK_COUNTERS (7*8) (do -- (crt,dud,ovf,cnv,gcd,fiz,rem) crt <- getE :: GetEvents Word64 dud <- getE :: GetEvents Word64 ovf <- getE :: GetEvents Word64 cnv <- getE :: GetEvents Word64- fiz <- getE :: GetEvents Word64 gcd <- getE :: GetEvents Word64+ fiz <- getE :: GetEvents Word64 rem <- getE :: GetEvents Word64 return SparkCounters{sparksCreated = crt, sparksDud = dud, sparksOverflowed = ovf, sparksConverted = cnv,+ -- Warning: order of fiz and gcd reversed! sparksFizzled = fiz, sparksGCd = gcd, sparksRemaining = rem} )),@@ -656,6 +723,26 @@ printf "GC idle" GCDone -> printf "GC done"+ GlobalSyncGC ->+ printf "all caps stopped for GC"+ GCStatsGHC{..} ->+ printf "GC stats for heap capset %d: generation %d, %d bytes copied, %d bytes slop, %d bytes fragmentation, %d par threads, %d bytes max par copied, %d bytes total par copied" heapCapset gen copied slop frag parNThreads parMaxCopied parTotCopied+ HeapAllocated{..} ->+ printf "allocated on heap capset %d: %d total bytes till now" heapCapset allocBytes+ HeapSize{..} ->+ printf "size of heap capset %d: %d bytes" heapCapset sizeBytes+ HeapLive{..} ->+ printf "live data in heap capset %d: %d bytes" heapCapset liveBytes+ HeapInfoGHC{..} ->+ printf "heap stats for heap capset %d: generations %d, %d bytes max heap size, %d bytes alloc area size, %d bytes mblock size, %d bytes block size" heapCapset gens maxHeapSize allocAreaSize mblockSize blockSize+ CapCreate{cap} ->+ printf "created cap %d" cap+ CapDelete{cap} ->+ printf "deleted cap %d" cap+ CapDisable{cap} ->+ printf "disabled cap %d" cap+ CapEnable{cap} ->+ printf "enabled cap %d" cap Message msg -> msg UserMessage msg ->@@ -827,6 +914,7 @@ ThreadLabel {} -> EVENT_THREAD_LABEL StartGC {} -> EVENT_GC_START EndGC {} -> EVENT_GC_END+ GlobalSyncGC {} -> EVENT_GC_GLOBAL_SYNC RequestSeqGC {} -> EVENT_REQUEST_SEQ_GC RequestParGC {} -> EVENT_REQUEST_PAR_GC CreateSparkThread {} -> EVENT_CREATE_SPARK_THREAD@@ -845,6 +933,15 @@ GCIdle {} -> EVENT_GC_IDLE GCWork {} -> EVENT_GC_WORK GCDone {} -> EVENT_GC_DONE+ GCStatsGHC{} -> EVENT_GC_STATS_GHC+ HeapAllocated{} -> EVENT_HEAP_ALLOCATED+ HeapSize{} -> EVENT_HEAP_SIZE+ HeapLive{} -> EVENT_HEAP_LIVE+ HeapInfoGHC{} -> EVENT_HEAP_INFO_GHC+ CapCreate{} -> EVENT_CAP_CREATE+ CapDelete{} -> EVENT_CAP_DELETE+ CapDisable{} -> EVENT_CAP_DISABLE+ CapEnable{} -> EVENT_CAP_ENABLE CapsetCreate {} -> EVENT_CAPSET_CREATE CapsetDelete {} -> EVENT_CAPSET_DELETE CapsetAssignCap {} -> EVENT_CAPSET_ASSIGN_CAP@@ -938,8 +1035,9 @@ putE dud putE ovf putE cnv- putE fiz+ -- Warning: order of fiz and gcd reversed! putE gcd+ putE fiz putE rem putEventSpec SparkCreate = do@@ -995,6 +1093,51 @@ putEventSpec EndGC = do return ()++putEventSpec GlobalSyncGC = do+ return ()++putEventSpec GCStatsGHC{..} = do+ putE heapCapset+ putE gen+ putE copied+ putE slop+ putE frag+ putE parNThreads+ putE parMaxCopied+ putE parTotCopied++putEventSpec HeapAllocated{..} = do+ putE heapCapset+ putE allocBytes++putEventSpec HeapSize{..} = do+ putE heapCapset+ putE sizeBytes++putEventSpec HeapLive{..} = do+ putE heapCapset+ putE liveBytes++putEventSpec HeapInfoGHC{..} = do+ putE heapCapset+ putE gens+ putE maxHeapSize+ putE allocAreaSize+ putE mblockSize+ putE blockSize++putEventSpec CapCreate{cap} = do+ putCap cap++putEventSpec CapDelete{cap} = do+ putCap cap++putEventSpec CapDisable{cap} = do+ putCap cap++putEventSpec CapEnable{cap} = do+ putCap cap putEventSpec (CapsetCreate cs ct) = do putE cs
ghc-events.cabal view
@@ -1,9 +1,16 @@ name: ghc-events-version: 0.4.0.0+version: 0.4.0.1 synopsis: Library and tool for parsing .eventlog files from GHC-description: Parses .eventlog files emitted by GHC 6.12.1 and later.- Includes the ghc-events tool permitting, in particular,- to dump an event log file as text.++description:+ Parses @.eventlog@ files emitted by GHC 6.12.1 and later.+ Includes the @ghc-events@ tool which dumps an event log file+ as text.+ .+ Changes in 0.4.0.1:+ .+ * compiles with GHC 7.6.1+ category: Development, GHC, Debug, Profiling, Trace license: BSD3 license-file: LICENSE@@ -27,10 +34,10 @@ library build-depends: base == 4.*,- mtl >= 1.1 && < 2.1,- containers >= 0.2 && < 0.5,+ mtl >= 1.1 && < 2.2,+ containers >= 0.2 && < 0.6, binary == 0.5.*,- bytestring == 0.9.*,+ bytestring >= 0.9.0, array >= 0.2 && < 0.5 exposed-modules: GHC.RTS.Events, GHC.RTS.Events.Merge