summaryrefslogtreecommitdiff
path: root/includes
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 /includes
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 'includes')
-rw-r--r--includes/rts/storage/GC.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 3c6e6f6e26..e57ffd23cf 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -181,6 +181,50 @@ void setKeepCAFs (void);
Stats
-------------------------------------------------------------------------- */
+typedef struct _GCStats {
+ StgWord64 bytes_allocated;
+ StgWord64 num_gcs;
+ StgWord64 num_byte_usage_samples;
+ StgWord64 max_bytes_used;
+ StgWord64 cumulative_bytes_used;
+ StgWord64 bytes_copied;
+ StgWord64 current_bytes_used;
+ StgWord64 current_bytes_slop;
+ StgWord64 max_bytes_slop;
+ StgWord64 peak_megabytes_allocated;
+ StgWord64 par_avg_bytes_copied;
+ StgWord64 par_max_bytes_copied;
+ StgDouble mutator_cpu_seconds;
+ StgDouble mutator_wall_seconds;
+ StgDouble gc_cpu_seconds;
+ StgDouble gc_wall_seconds;
+} GCStats;
+void getGCStats (GCStats *s);
+
+// These don't change over execution, so do them elsewhere
+// StgDouble init_cpu_seconds;
+// StgDouble init_wall_seconds;
+
+typedef struct _ParGCStats {
+ StgWord64 avg_copied;
+ StgWord64 max_copied;
+} ParGCStats;
+void getParGCStats (ParGCStats *s);
+
+/*
+typedef struct _TaskStats {
+ StgWord64 mut_time;
+ StgWord64 mut_etime;
+ StgWord64 gc_time;
+ StgWord64 gc_etime;
+} TaskStats;
+// would need to allocate arbitrarily large amount of memory
+// because it's a linked list of results
+void getTaskStats (TaskStats **s);
+// Need to stuff SparkCounters in a public header file...
+void getSparkStats (SparkCounters *s);
+*/
+
// Returns the total number of bytes allocated since the start of the program.
HsInt64 getAllocations (void);