NonMoving: Trace swept segment counts
authorBen Gamari <ben@smart-cactus.org>
Thu, 16 May 2019 14:20:00 +0000 (10:20 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 21 May 2019 13:39:37 +0000 (09:39 -0400)
rts/sm/NonMovingSweep.c

index e70933f..aa0ca1a 100644 (file)
@@ -126,6 +126,7 @@ clear_segment_free_blocks(struct NonmovingSegment* seg)
 
 GNUC_ATTR_HOT void nonmovingSweep(void)
 {
+    int n_freed=0, n_active=0, n_filled=0;
     while (nonmovingHeap.sweep_list) {
         struct NonmovingSegment *seg = nonmovingHeap.sweep_list;
 
@@ -139,18 +140,24 @@ GNUC_ATTR_HOT void nonmovingSweep(void)
         case SEGMENT_FREE:
             IF_DEBUG(sanity, clear_segment(seg));
             nonmovingPushFreeSegment(seg);
+            n_freed++;
             break;
         case SEGMENT_PARTIAL:
             IF_DEBUG(sanity, clear_segment_free_blocks(seg));
             nonmovingPushActiveSegment(seg);
+            n_active++;
             break;
         case SEGMENT_FILLED:
             nonmovingPushFilledSegment(seg);
+            n_filled++;
             break;
         default:
             barf("nonmovingSweep: weird sweep return: %d\n", ret);
         }
     }
+
+    debugTrace(DEBUG_nonmoving_gc, "Pushed %d free, %d active, %d filled segments\n",
+               n_freed, n_active, n_filled);
 }
 
 /* N.B. This happens during the pause so we own all capabilities. */