summaryrefslogtreecommitdiff
path: root/rts/Stats.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2012-02-22 18:25:27 +0000
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:45 +0100
commit1f809ce6df1dca54b977c6cac8f2b1c745683cf9 (patch)
tree889ba5ffb8c739988e552e9e9df87f6f87724606 /rts/Stats.c
parente88f1625a234e5316e903f84ae4d3349fec4bf3d (diff)
downloadhaskell-1f809ce6df1dca54b977c6cac8f2b1c745683cf9.tar.gz
Emit final heap alloc events and rearrange code to calculate alloc totals
In stat_exit we want to emit a final EVENT_HEAP_ALLOCATED for each cap so that we get the same total allocation count as reported via +RTS -s. To do so we need to update the per-cap total_allocated counts. Previously we had a single calcAllocated(rtsBool) function that counted the large allocations and optionally the nurseries for all caps. The GC would always call it with false, and the stat_exit always with true. The reason for these two modes is that the GC counts the nurseries via clearNurseries() (which also updates the per-cap total_allocated counts), so it's only the stat_exit() path that needs to count them. We now split the calcAllocated() function into two: countLargeAllocated and updateNurseriesStats. As the name suggests, the latter now updates the per-cap total_allocated counts, in additon to returning a total.
Diffstat (limited to 'rts/Stats.c')
-rw-r--r--rts/Stats.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/Stats.c b/rts/Stats.c
index a7335531ce..29cae21bf3 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -588,6 +588,12 @@ stat_exit(int alloc)
GC_tot_alloc += alloc;
+ for (i = 0; i < n_capabilities; i++) {
+ traceEventHeapAllocated(&capabilities[i],
+ CAPSET_HEAP_DEFAULT,
+ capabilities[i].total_allocated * sizeof(W_));
+ }
+
/* Count total garbage collections */
for (g = 0; g < RtsFlags.GcFlags.generations; g++)
total_collections += generations[g].collections;