summaryrefslogtreecommitdiff
path: root/rts/Stats.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2012-02-03 12:57:19 +0000
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:44 +0100
commit8536f09c2f310a95297b339de6084f77cc4044c1 (patch)
tree5d558fb07d6c6c1abef09bfd64fac8a548aaa5e0 /rts/Stats.c
parentf9c2e8543cabd6661eec17d5be31469455a64e05 (diff)
downloadhaskell-8536f09c2f310a95297b339de6084f77cc4044c1.tar.gz
Calculate the total memory allocated on a per-capability basis
In addition to the existing global method. For now we just do it both ways and assert they give the same grand total. At some stage we can simplify the global method to just take the sum of the per-cap counters.
Diffstat (limited to 'rts/Stats.c')
-rw-r--r--rts/Stats.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/rts/Stats.c b/rts/Stats.c
index 2c7c35d533..76444b3611 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -375,6 +375,22 @@ stat_endGC (gc_thread *gct,
GC_par_max_copied += (StgWord64) max_copied;
GC_par_avg_copied += (StgWord64) avg_copied;
GC_tot_cpu += gc_cpu;
+
+ /* For the moment we calculate both per-HEC and total allocation.
+ * There is thus redundancy here, but for the moment we will calculate
+ * it both the old and new way and assert they're the same.
+ * When we're sure it's working OK then we can simplify things.
+ * TODO: simplify calcAllocated and clearNurseries so they don't have
+ * to calculate the total
+ */
+ {
+ lnat tot_alloc = 0;
+ lnat n;
+ for (n = 0; n < n_capabilities; n++) {
+ tot_alloc += capabilities[n].total_allocated;
+ }
+ ASSERT(GC_tot_alloc == tot_alloc);
+ }
if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
if (live > max_residency) {