diff --git a/mps/code/amcss.c b/mps/code/amcss.c index bc0d8861149..9af1670acfd 100644 --- a/mps/code/amcss.c +++ b/mps/code/amcss.c @@ -45,14 +45,14 @@ static mps_ap_t ap; static mps_addr_t exactRoots[exactRootsCOUNT]; static mps_addr_t ambigRoots[ambigRootsCOUNT]; static size_t scale; /* Overall scale factor. */ +static unsigned long nCollsStart; +static unsigned long nCollsDone; /* report -- report statistics from any messages */ static void report(mps_arena_t arena) { - static int nCollsStart = 0; - static int nCollsDone = 0; mps_message_type_t type; while(mps_message_queue_type(&type, arena)) { @@ -62,7 +62,7 @@ static void report(mps_arena_t arena) if (type == mps_message_type_gc_start()) { nCollsStart += 1; - printf("\n{\n Collection %d started. Because:\n", nCollsStart); + printf("\n{\n Collection %lu started. Because:\n", nCollsStart); printf(" %s\n", mps_message_gc_start_why(arena, message)); printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message)); @@ -74,7 +74,7 @@ static void report(mps_arena_t arena) condemned = mps_message_gc_condemned_size(arena, message); not_condemned = mps_message_gc_not_condemned_size(arena, message); - printf("\n Collection %d finished:\n", nCollsDone); + printf("\n Collection %lu finished:\n", nCollsDone); printf(" live %"PRIuLONGEST"\n", (ulongest_t)live); printf(" condemned %"PRIuLONGEST"\n", (ulongest_t)condemned); printf(" not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned); @@ -167,6 +167,8 @@ static void test(mps_arena_t arena, mps_pool_class_t pool_class, /* create an ap, and leave it busy */ die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy"); + nCollsStart = 0; + nCollsDone = 0; collections = 0; rampSwitch = rampSIZE; die(mps_ap_alloc_pattern_begin(ap, ramp), "pattern begin (ap)"); @@ -174,20 +176,18 @@ static void test(mps_arena_t arena, mps_pool_class_t pool_class, ramping = 1; objs = 0; while (collections < collectionsCOUNT) { - mps_word_t c; size_t r; - c = mps_collections(arena); - if (collections != c) { + report(arena); + if (collections != nCollsStart) { if (!described) { die(ArenaDescribe(arena, mps_lib_get_stdout(), 0), "ArenaDescribe"); described = TRUE; } - collections = c; - report(arena); + collections = nCollsStart; - printf("%lu objects (mps_collections says: %"PRIuLONGEST")\n", objs, - (ulongest_t)c); + printf("%lu objects (nCollsStart=%"PRIuLONGEST")\n", objs, + (ulongest_t)collections); /* test mps_arena_has_addr */ {