[commit: ghc] master: Add mblocks_allocated to GC stats API (b0a5144)
git at git.haskell.org
git at git.haskell.org
Wed Jul 27 15:25:38 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b0a5144348d6abad18e771ad2cf3134a5724b969/ghc
>---------------------------------------------------------------
commit b0a5144348d6abad18e771ad2cf3134a5724b969
Author: Bartosz Nitka <niteria at gmail.com>
Date: Wed Jul 27 08:24:40 2016 -0700
Add mblocks_allocated to GC stats API
This exposes mblocks_allocated in the GCStats struct.
Test Plan: it builds
Reviewers: bgamari, simonmar, austin, hvr, erikd
Reviewed By: erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2429
>---------------------------------------------------------------
b0a5144348d6abad18e771ad2cf3134a5724b969
includes/rts/storage/GC.h | 1 +
libraries/base/GHC/Stats.hsc | 2 ++
rts/Stats.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 50fc5eb..6dc483f 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -237,6 +237,7 @@ typedef struct _GCStats {
StgWord64 current_bytes_slop;
StgWord64 max_bytes_slop;
StgWord64 peak_megabytes_allocated;
+ StgWord64 mblocks_allocated;
StgWord64 par_tot_bytes_copied;
StgWord64 par_max_bytes_copied;
StgDouble mutator_cpu_seconds;
diff --git a/libraries/base/GHC/Stats.hsc b/libraries/base/GHC/Stats.hsc
index 73e2de9..a8b43ef 100644
--- a/libraries/base/GHC/Stats.hsc
+++ b/libraries/base/GHC/Stats.hsc
@@ -72,6 +72,7 @@ data GCStats = GCStats
, peakMegabytesAllocated :: !Int64
-- | CPU time spent running mutator threads. This does not include
-- any profiling overhead or initialization.
+ , mblocksAllocated :: !Int64 -- ^ Number of allocated megablocks
, mutatorCpuSeconds :: !Double
-- | Wall clock time spent running mutator threads. This does not
@@ -131,6 +132,7 @@ getGCStats = do
currentBytesSlop <- (# peek GCStats, current_bytes_slop) p
maxBytesSlop <- (# peek GCStats, max_bytes_slop) p
peakMegabytesAllocated <- (# peek GCStats, peak_megabytes_allocated ) p
+ mblocksAllocated <- (# peek GCStats, mblocks_allocated) p
{-
initCpuSeconds <- (# peek GCStats, init_cpu_seconds) p
initWallSeconds <- (# peek GCStats, init_wall_seconds) p
diff --git a/rts/Stats.c b/rts/Stats.c
index e422a36..d10738a 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -883,6 +883,7 @@ extern void getGCStats( GCStats *s )
s->max_bytes_used = max_residency*sizeof(W_);
s->cumulative_bytes_used = cumulative_residency*(StgWord64)sizeof(W_);
s->peak_megabytes_allocated = (StgWord64)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L));
+ s->mblocks_allocated = (StgWord64)mblocks_allocated;
s->bytes_copied = GC_tot_copied*(StgWord64)sizeof(W_);
s->max_bytes_slop = max_slop*(StgWord64)sizeof(W_);
s->current_bytes_used = current_residency*(StgWord64)sizeof(W_);
More information about the ghc-commits
mailing list