- if (GC_print_stats) {
- GET_TIME(current_time);
- GC_log_printf("World-stopped marking took %lu msecs\n",
- MS_TIME_DIFF(current_time,start_time));
- }
+# ifndef SMALL_CONFIG
+ if (GC_print_stats) {
+ unsigned long time_diff;
+ unsigned total_time, divisor;
+ GET_TIME(current_time);
+ time_diff = MS_TIME_DIFF(current_time,start_time);
+
+ /* Compute new world-stop delay total time */
+ total_time = world_stopped_total_time;
+ divisor = world_stopped_total_divisor;
+ if ((int)total_time < 0 || divisor >= MAX_TOTAL_TIME_DIVISOR) {
+ /* Halve values if overflow occurs */
+ total_time >>= 1;
+ divisor >>= 1;
+ }
+ total_time += time_diff < (((unsigned)-1) >> 1) ?
+ (unsigned)time_diff : ((unsigned)-1) >> 1;
+ /* Update old world_stopped_total_time and its divisor */
+ world_stopped_total_time = total_time;
+ world_stopped_total_divisor = ++divisor;
+
+ GC_ASSERT(divisor != 0);
+ GC_log_printf(
+ "World-stopped marking took %lu msecs (%u in average)\n",
+ time_diff, total_time / divisor);
+ }
+# endif