@@ -305,9 +305,7 @@ static void timerlat_hist_header(struct osnoise_tool *tool)
305305 if (!params -> common .hist .no_index )
306306 trace_seq_printf (s , "Index" );
307307
308- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
309- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
310- continue ;
308+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
311309
312310 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
313311 continue ;
@@ -359,9 +357,7 @@ timerlat_print_summary(struct timerlat_params *params,
359357 if (!params -> common .hist .no_index )
360358 trace_seq_printf (trace -> seq , "count:" );
361359
362- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
363- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
364- continue ;
360+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
365361
366362 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
367363 continue ;
@@ -383,9 +379,7 @@ timerlat_print_summary(struct timerlat_params *params,
383379 if (!params -> common .hist .no_index )
384380 trace_seq_printf (trace -> seq , "min: " );
385381
386- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
387- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
388- continue ;
382+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
389383
390384 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
391385 continue ;
@@ -413,9 +407,7 @@ timerlat_print_summary(struct timerlat_params *params,
413407 if (!params -> common .hist .no_index )
414408 trace_seq_printf (trace -> seq , "avg: " );
415409
416- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
417- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
418- continue ;
410+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
419411
420412 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
421413 continue ;
@@ -443,9 +435,7 @@ timerlat_print_summary(struct timerlat_params *params,
443435 if (!params -> common .hist .no_index )
444436 trace_seq_printf (trace -> seq , "max: " );
445437
446- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
447- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
448- continue ;
438+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
449439
450440 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
451441 continue ;
@@ -490,9 +480,7 @@ timerlat_print_stats_all(struct timerlat_params *params,
490480 sum .min_thread = ~0 ;
491481 sum .min_user = ~0 ;
492482
493- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
494- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
495- continue ;
483+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
496484
497485 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
498486 continue ;
@@ -639,9 +627,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
639627 trace_seq_printf (trace -> seq , "%-6d" ,
640628 bucket * data -> bucket_size );
641629
642- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
643- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
644- continue ;
630+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
645631
646632 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
647633 continue ;
@@ -679,9 +665,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
679665 if (!params -> common .hist .no_index )
680666 trace_seq_printf (trace -> seq , "over: " );
681667
682- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
683- if (params -> common .cpus && !CPU_ISSET (cpu , & params -> common .monitored_cpus ))
684- continue ;
668+ for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
685669
686670 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
687671 continue ;
0 commit comments