summaryrefslogtreecommitdiff
path: root/rts/Trace.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2012-02-06 12:22:18 +0000
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:44 +0100
commit65aaa9b2715c5245838123f3a0fa5d92e0a66bce (patch)
treec590a78588274f19285965d7b5cbd3b051a9329a /rts/Trace.c
parentcd930da1145a0d6094e5b5380034e80d002d5b9a (diff)
downloadhaskell-65aaa9b2715c5245838123f3a0fa5d92e0a66bce.tar.gz
Add new eventlog events for various heap and GC statistics
They cover much the same info as is available via the GHC.Stats module or via the '+RTS -s' textual output, but via the eventlog and with a better sampling frequency. We have three new generic heap info events and two very GHC-specific ones. (The hope is the general ones are usable by other implementations that use the same eventlog system, or indeed not so sensitive to changes in GHC itself.) The general ones are: * total heap mem allocated since prog start, on a per-HEC basis * current size of the heap (MBlocks reserved from OS for the heap) * current size of live data in the heap Currently these are all emitted by GHC at GC time (live data only at major GC). The GHC specific ones are: * an event giving various static heap paramaters: * number of generations (usually 2) * max size if any * nursary size * MBlock and block sizes * a event emitted on each GC containing: * GC generation (usually just 0,1) * total bytes copied * bytes lost to heap slop and fragmentation * the number of threads in the parallel GC (1 for serial) * the maximum number of bytes copied by any par GC thread * the total number of bytes copied by all par GC threads (these last three can be used to calculate an estimate of the work balance in parallel GCs)
Diffstat (limited to 'rts/Trace.c')
-rw-r--r--rts/Trace.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/rts/Trace.c b/rts/Trace.c
index 70eb6ce506..f597726f90 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -98,6 +98,9 @@ void initTracing (void)
TRACE_gc =
RtsFlags.TraceFlags.gc ||
RtsFlags.DebugFlags.gc;
+ if (TRACE_gc && RtsFlags.GcFlags.giveStats == NO_GC_STATS) {
+ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
+ }
TRACE_spark_sampled =
RtsFlags.TraceFlags.sparks_sampled;
@@ -301,6 +304,44 @@ void traceGcEvent_ (Capability *cap, EventTypeNum tag)
}
}
+void traceHeapEvent_ (Capability *cap,
+ EventTypeNum tag,
+ CapsetID heap_capset,
+ lnat info1)
+{
+ /* no stderr equivalent for these ones */
+ postHeapEvent(cap, tag, heap_capset, info1);
+}
+
+void traceEventHeapInfo_ (CapsetID heap_capset,
+ nat gens,
+ lnat maxHeapSize,
+ lnat allocAreaSize,
+ lnat mblockSize,
+ lnat blockSize)
+{
+ /* no stderr equivalent for this one */
+ postEventHeapInfo(heap_capset, gens,
+ maxHeapSize, allocAreaSize,
+ mblockSize, blockSize);
+}
+
+void traceEventGcStats_ (Capability *cap,
+ CapsetID heap_capset,
+ nat gen,
+ lnat copied,
+ lnat slop,
+ lnat fragmentation,
+ nat par_n_threads,
+ lnat par_max_copied,
+ lnat par_tot_copied)
+{
+ /* no stderr equivalent for this one */
+ postEventGcStats(cap, heap_capset, gen,
+ copied, slop, fragmentation,
+ par_n_threads, par_max_copied, par_tot_copied);
+}
+
void traceCapEvent (Capability *cap,
EventTypeNum tag)
{