@@ -44,7 +44,6 @@ struct timerlat_hist_data {
4444 struct timerlat_hist_cpu * hist ;
4545 int entries ;
4646 int bucket_size ;
47- int nr_cpus ;
4847};
4948
5049/*
@@ -56,7 +55,7 @@ timerlat_free_histogram(struct timerlat_hist_data *data)
5655 int cpu ;
5756
5857 /* one histogram for IRQ and one for thread, per CPU */
59- for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
58+ for (cpu = 0 ; cpu < nr_cpus ; cpu ++ ) {
6059 if (data -> hist [cpu ].irq )
6160 free (data -> hist [cpu ].irq );
6261
@@ -94,7 +93,6 @@ static struct timerlat_hist_data
9493
9594 data -> entries = entries ;
9695 data -> bucket_size = bucket_size ;
97- data -> nr_cpus = nr_cpus ;
9896
9997 /* one set of histograms per CPU */
10098 data -> hist = calloc (1 , sizeof (* data -> hist ) * nr_cpus );
@@ -204,17 +202,17 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
204202{
205203 struct timerlat_hist_data * data = tool -> data ;
206204 int i , j , err ;
207- long long value_irq [data -> nr_cpus ],
208- value_thread [data -> nr_cpus ],
209- value_user [data -> nr_cpus ];
205+ long long value_irq [nr_cpus ],
206+ value_thread [nr_cpus ],
207+ value_user [nr_cpus ];
210208
211209 /* Pull histogram */
212210 for (i = 0 ; i < data -> entries ; i ++ ) {
213211 err = timerlat_bpf_get_hist_value (i , value_irq , value_thread ,
214212 value_user );
215213 if (err )
216214 return err ;
217- for (j = 0 ; j < data -> nr_cpus ; j ++ ) {
215+ for (j = 0 ; j < nr_cpus ; j ++ ) {
218216 data -> hist [j ].irq [i ] = value_irq [j ];
219217 data -> hist [j ].thread [i ] = value_thread [j ];
220218 data -> hist [j ].user [i ] = value_user [j ];
@@ -226,7 +224,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
226224 value_irq , value_thread , value_user );
227225 if (err )
228226 return err ;
229- for (i = 0 ; i < data -> nr_cpus ; i ++ ) {
227+ for (i = 0 ; i < nr_cpus ; i ++ ) {
230228 data -> hist [i ].irq_count = value_irq [i ];
231229 data -> hist [i ].thread_count = value_thread [i ];
232230 data -> hist [i ].user_count = value_user [i ];
@@ -236,7 +234,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
236234 value_irq , value_thread , value_user );
237235 if (err )
238236 return err ;
239- for (i = 0 ; i < data -> nr_cpus ; i ++ ) {
237+ for (i = 0 ; i < nr_cpus ; i ++ ) {
240238 data -> hist [i ].min_irq = value_irq [i ];
241239 data -> hist [i ].min_thread = value_thread [i ];
242240 data -> hist [i ].min_user = value_user [i ];
@@ -246,7 +244,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
246244 value_irq , value_thread , value_user );
247245 if (err )
248246 return err ;
249- for (i = 0 ; i < data -> nr_cpus ; i ++ ) {
247+ for (i = 0 ; i < nr_cpus ; i ++ ) {
250248 data -> hist [i ].max_irq = value_irq [i ];
251249 data -> hist [i ].max_thread = value_thread [i ];
252250 data -> hist [i ].max_user = value_user [i ];
@@ -256,7 +254,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
256254 value_irq , value_thread , value_user );
257255 if (err )
258256 return err ;
259- for (i = 0 ; i < data -> nr_cpus ; i ++ ) {
257+ for (i = 0 ; i < nr_cpus ; i ++ ) {
260258 data -> hist [i ].sum_irq = value_irq [i ];
261259 data -> hist [i ].sum_thread = value_thread [i ];
262260 data -> hist [i ].sum_user = value_user [i ];
@@ -266,7 +264,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool)
266264 value_irq , value_thread , value_user );
267265 if (err )
268266 return err ;
269- for (i = 0 ; i < data -> nr_cpus ; i ++ ) {
267+ for (i = 0 ; i < nr_cpus ; i ++ ) {
270268 data -> hist [i ].irq [data -> entries ] = value_irq [i ];
271269 data -> hist [i ].thread [data -> entries ] = value_thread [i ];
272270 data -> hist [i ].user [data -> entries ] = value_user [i ];
@@ -300,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *tool)
300298 if (!params -> common .hist .no_index )
301299 trace_seq_printf (s , "Index" );
302300
303- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
301+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
304302
305303 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
306304 continue ;
@@ -352,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params,
352350 if (!params -> common .hist .no_index )
353351 trace_seq_printf (trace -> seq , "count:" );
354352
355- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
353+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
356354
357355 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
358356 continue ;
@@ -374,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params,
374372 if (!params -> common .hist .no_index )
375373 trace_seq_printf (trace -> seq , "min: " );
376374
377- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
375+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
378376
379377 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
380378 continue ;
@@ -402,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params,
402400 if (!params -> common .hist .no_index )
403401 trace_seq_printf (trace -> seq , "avg: " );
404402
405- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
403+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
406404
407405 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
408406 continue ;
@@ -430,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params,
430428 if (!params -> common .hist .no_index )
431429 trace_seq_printf (trace -> seq , "max: " );
432430
433- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
431+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
434432
435433 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
436434 continue ;
@@ -475,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params,
475473 sum .min_thread = ~0 ;
476474 sum .min_user = ~0 ;
477475
478- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
476+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
479477
480478 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
481479 continue ;
@@ -622,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
622620 trace_seq_printf (trace -> seq , "%-6d" ,
623621 bucket * data -> bucket_size );
624622
625- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
623+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
626624
627625 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
628626 continue ;
@@ -660,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
660658 if (!params -> common .hist .no_index )
661659 trace_seq_printf (trace -> seq , "over: " );
662660
663- for_each_monitored_cpu (cpu , data -> nr_cpus , & params -> common ) {
661+ for_each_monitored_cpu (cpu , nr_cpus , & params -> common ) {
664662
665663 if (!data -> hist [cpu ].irq_count && !data -> hist [cpu ].thread_count )
666664 continue ;
0 commit comments