NonmovingCensus: Emit samples to eventlog
[ghc.git] / rts / sm / NonMovingCensus.c
index 1f28f4e..670d512 100644 (file)
@@ -90,6 +90,9 @@ nonmovingAllocatorCensus(struct NonmovingAllocator *alloc)
 
 void nonmovingPrintAllocatorCensus()
 {
+    if (!RtsFlags.GcFlags.useNonmoving)
+        return;
+
     for (int i=0; i < NONMOVING_ALLOCA_CNT; i++) {
         struct NonmovingAllocCensus census =
             nonmovingAllocatorCensus(nonmovingHeap.allocators[i]);
@@ -109,3 +112,18 @@ void nonmovingPrintAllocatorCensus()
                    occupancy);
     }
 }
+
+void nonmovingTraceAllocatorCensus()
+{
+#if defined(TRACING)
+    if (!RtsFlags.GcFlags.useNonmoving && !TRACE_nonmoving_gc)
+        return;
+
+    for (int i=0; i < NONMOVING_ALLOCA_CNT; i++) {
+        const struct NonmovingAllocCensus census =
+            nonmovingAllocatorCensus(nonmovingHeap.allocators[i]);
+        const uint32_t log_blk_size = i + NONMOVING_ALLOCA0;
+        traceNonmovingHeapCensus(log_blk_size, &census);
+    }
+#endif
+}