summaryrefslogtreecommitdiff
path: root/rts/RtsFlags.c
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2011-07-30 16:02:10 -0400
committerEdward Z. Yang <ezyang@mit.edu>2011-07-30 22:42:16 -0400
commit2088abaf4173090e343b521dc89d622936fba850 (patch)
treeb91cb65036f5231cfc83fcc3e9610922db47e81a /rts/RtsFlags.c
parent2ad66b597b139ea73830f2aedf564df2b72960e9 (diff)
downloadhaskell-2088abaf4173090e343b521dc89d622936fba850.tar.gz
Implement public interface for GC statistics.
We add a new RTS flag -T for collecting statistics but not giving any new inputs. There is one new struct in rts/storage/GC.h: GCStats. We add two new global counters current_residency and current_slop, which are useful for in-program GC statistics. See GHC.Stats in base for a Haskell interface to this functionality. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r--rts/RtsFlags.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index fcc1f49a36..eda327dd50 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -236,6 +236,7 @@ usage_text[] = {
" -I<sec> Perform full GC after <sec> idle time (default: 0.3, 0 == off)",
#endif
"",
+" -T Collect GC statistics (useful for in-program statistics access)"
" -t[<file>] One-line GC statistics (if <file> omitted, uses stderr)",
" -s[<file>] Summary GC statistics (if <file> omitted, uses stderr)",
" -S[<file>] Detailed GC statistics (if <file> omitted, uses stderr)",
@@ -841,6 +842,10 @@ error = rtsTrue;
}
break;
+ case 'T':
+ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
+ break; /* Don't initialize statistics file. */
+
case 'S':
RtsFlags.GcFlags.giveStats = VERBOSE_GC_STATS;
goto stats;