@@ -110,6 +110,12 @@ void print_scheduler_stats(scheduler_t* sched)
110110 );
111111}
112112
113+ /* Get whether stat printing is on */
114+ bool ponyint_sched_print_stats ()
115+ {
116+ return print_stats ;
117+ }
118+
113119/** Get the static memory used by the scheduler subsystem.
114120 */
115121size_t ponyint_sched_static_mem_size ()
@@ -1134,7 +1140,7 @@ static void run(scheduler_t* sched)
11341140 while (true)
11351141 {
11361142#ifdef USE_RUNTIMESTATS
1137- if (print_stats )
1143+ if (ponyint_sched_print_stats () )
11381144 {
11391145 // convert to cycles for use with ponyint_cpu_tick()
11401146 // 1 second = 2000000000 cycles (approx.)
@@ -1219,7 +1225,8 @@ static void run(scheduler_t* sched)
12191225#ifdef USE_RUNTIMESTATS
12201226 uint64_t used_cpu = ponyint_sched_cpu_used (& sched -> ctx );
12211227 sched -> ctx .schedulerstats .misc_cpu += used_cpu ;
1222- print_scheduler_stats (sched );
1228+ if (ponyint_sched_print_stats ())
1229+ print_scheduler_stats (sched );
12231230#endif
12241231
12251232 // Termination.
@@ -1427,7 +1434,7 @@ static void run_pinned_actors()
14271434 while (true)
14281435 {
14291436#ifdef USE_RUNTIMESTATS
1430- if (print_stats )
1437+ if (ponyint_sched_print_stats () )
14311438 {
14321439 // convert to cycles for use with ponyint_cpu_tick()
14331440 // 1 second = 2000000000 cycles (approx.)
@@ -1454,8 +1461,9 @@ static void run_pinned_actors()
14541461 if (sched -> terminate )
14551462 {
14561463#ifdef USE_RUNTIMESTATS
1457- uint64_t used_cpu = ponyint_sched_cpu_used (& sched -> ctx );
1458- sched -> ctx .schedulerstats .misc_cpu += used_cpu ;
1464+ uint64_t used_cpu = ponyint_sched_cpu_used (& sched -> ctx );
1465+ sched -> ctx .schedulerstats .misc_cpu += used_cpu ;
1466+ if (ponyint_sched_print_stats ())
14591467 print_scheduler_stats (sched );
14601468#endif
14611469
@@ -1484,7 +1492,7 @@ static void run_pinned_actors()
14841492 uint64_t clocks_elapsed = tsc2 - tsc ;
14851493
14861494 // We had an empty queue and no actor. need to suspend or sleep only if
1487- // mutemap is empty as this thread doesn't participate in work stealing
1495+ // mutemap is empty as this thread doesn't participate in work stealing
14881496 if (ponyint_mutemap_size (& sched -> mute_mapping ) == 0 && clocks_elapsed > scheduler_suspend_threshold )
14891497 {
14901498 // suspend
0 commit comments