@@ -102,8 +102,8 @@ static void osnoise_hist_update_multiple(struct osnoise_tool *tool, int cpu,
102102 int bucket ;
103103 int * hist ;
104104
105- if (params -> output_divisor )
106- duration = duration / params -> output_divisor ;
105+ if (params -> common . output_divisor )
106+ duration = duration / params -> common . output_divisor ;
107107
108108 bucket = duration / data -> bucket_size ;
109109
@@ -146,7 +146,7 @@ static int osnoise_init_trace_hist(struct osnoise_tool *tool)
146146 /*
147147 * Set the size of the bucket.
148148 */
149- bucket_size = params -> output_divisor * params -> bucket_size ;
149+ bucket_size = params -> common . output_divisor * params -> common . hist . bucket_size ;
150150 snprintf (buff , sizeof (buff ), "duration.buckets=%d" , bucket_size );
151151
152152 data -> trace_hist = tracefs_hist_alloc (tool -> trace .tep , "osnoise" , "sample_threshold" ,
@@ -228,18 +228,18 @@ static void osnoise_hist_header(struct osnoise_tool *tool)
228228 char duration [26 ];
229229 int cpu ;
230230
231- if (params -> no_header )
231+ if (params -> common . hist . no_header )
232232 return ;
233233
234234 get_duration (tool -> start_time , duration , sizeof (duration ));
235235 trace_seq_printf (s , "# RTLA osnoise histogram\n" );
236236 trace_seq_printf (s , "# Time unit is %s (%s)\n" ,
237- params -> output_divisor == 1 ? "nanoseconds" : "microseconds" ,
238- params -> output_divisor == 1 ? "ns" : "us" );
237+ params -> common . output_divisor == 1 ? "nanoseconds" : "microseconds" ,
238+ params -> common . output_divisor == 1 ? "ns" : "us" );
239239
240240 trace_seq_printf (s , "# Duration: %s\n" , duration );
241241
242- if (!params -> no_index )
242+ if (!params -> common . hist . no_index )
243243 trace_seq_printf (s , "Index" );
244244
245245 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -267,10 +267,10 @@ osnoise_print_summary(struct osnoise_params *params,
267267{
268268 int cpu ;
269269
270- if (params -> no_summary )
270+ if (params -> common . hist . no_summary )
271271 return ;
272272
273- if (!params -> no_index )
273+ if (!params -> common . hist . no_index )
274274 trace_seq_printf (trace -> seq , "count:" );
275275
276276 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -284,7 +284,7 @@ osnoise_print_summary(struct osnoise_params *params,
284284 }
285285 trace_seq_printf (trace -> seq , "\n" );
286286
287- if (!params -> no_index )
287+ if (!params -> common . hist . no_index )
288288 trace_seq_printf (trace -> seq , "min: " );
289289
290290 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -299,7 +299,7 @@ osnoise_print_summary(struct osnoise_params *params,
299299 }
300300 trace_seq_printf (trace -> seq , "\n" );
301301
302- if (!params -> no_index )
302+ if (!params -> common . hist . no_index )
303303 trace_seq_printf (trace -> seq , "avg: " );
304304
305305 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -317,7 +317,7 @@ osnoise_print_summary(struct osnoise_params *params,
317317 }
318318 trace_seq_printf (trace -> seq , "\n" );
319319
320- if (!params -> no_index )
320+ if (!params -> common . hist . no_index )
321321 trace_seq_printf (trace -> seq , "max: " );
322322
323323 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -352,7 +352,7 @@ osnoise_print_stats(struct osnoise_params *params, struct osnoise_tool *tool)
352352 for (bucket = 0 ; bucket < data -> entries ; bucket ++ ) {
353353 total = 0 ;
354354
355- if (!params -> no_index )
355+ if (!params -> common . hist . no_index )
356356 trace_seq_printf (trace -> seq , "%-6d" ,
357357 bucket * data -> bucket_size );
358358
@@ -367,7 +367,7 @@ osnoise_print_stats(struct osnoise_params *params, struct osnoise_tool *tool)
367367 trace_seq_printf (trace -> seq , "%9d " , data -> hist [cpu ].samples [bucket ]);
368368 }
369369
370- if (total == 0 && !params -> with_zeros ) {
370+ if (total == 0 && !params -> common . hist . with_zeros ) {
371371 trace_seq_reset (trace -> seq );
372372 continue ;
373373 }
@@ -391,7 +391,7 @@ osnoise_print_stats(struct osnoise_params *params, struct osnoise_tool *tool)
391391 return ;
392392 }
393393
394- if (!params -> no_index )
394+ if (!params -> common . hist . no_index )
395395 trace_seq_printf (trace -> seq , "over: " );
396396
397397 for (cpu = 0 ; cpu < data -> nr_cpus ; cpu ++ ) {
@@ -490,9 +490,9 @@ static struct osnoise_params
490490 exit (1 );
491491
492492 /* display data in microseconds */
493- params -> output_divisor = 1000 ;
494- params -> bucket_size = 1 ;
495- params -> entries = 256 ;
493+ params -> common . output_divisor = 1000 ;
494+ params -> common . hist . bucket_size = 1 ;
495+ params -> common . hist . entries = 256 ;
496496
497497 while (1 ) {
498498 static struct option long_options [] = {
@@ -547,8 +547,9 @@ static struct osnoise_params
547547
548548 break ;
549549 case 'b' :
550- params -> bucket_size = get_llong_from_str (optarg );
551- if ((params -> bucket_size == 0 ) || (params -> bucket_size >= 1000000 ))
550+ params -> common .hist .bucket_size = get_llong_from_str (optarg );
551+ if (params -> common .hist .bucket_size == 0 ||
552+ params -> common .hist .bucket_size >= 1000000 )
552553 osnoise_hist_usage ("Bucket size needs to be > 0 and <= 1000000\n" );
553554 break ;
554555 case 'c' :
@@ -588,8 +589,9 @@ static struct osnoise_params
588589 params -> common .events = tevent ;
589590 break ;
590591 case 'E' :
591- params -> entries = get_llong_from_str (optarg );
592- if ((params -> entries < 10 ) || (params -> entries > 9999999 ))
592+ params -> common .hist .entries = get_llong_from_str (optarg );
593+ if (params -> common .hist .entries < 10 ||
594+ params -> common .hist .entries > 9999999 )
593595 osnoise_hist_usage ("Entries must be > 10 and < 9999999\n" );
594596 break ;
595597 case 'h' :
@@ -641,16 +643,16 @@ static struct osnoise_params
641643 params -> trace_output = "osnoise_trace.txt" ;
642644 break ;
643645 case '0' : /* no header */
644- params -> no_header = 1 ;
646+ params -> common . hist . no_header = 1 ;
645647 break ;
646648 case '1' : /* no summary */
647- params -> no_summary = 1 ;
649+ params -> common . hist . no_summary = 1 ;
648650 break ;
649651 case '2' : /* no index */
650- params -> no_index = 1 ;
652+ params -> common . hist . no_index = 1 ;
651653 break ;
652654 case '3' : /* with zeros */
653- params -> with_zeros = 1 ;
655+ params -> common . hist . with_zeros = 1 ;
654656 break ;
655657 case '4' : /* trigger */
656658 if (params -> common .events ) {
@@ -690,7 +692,7 @@ static struct osnoise_params
690692 exit (EXIT_FAILURE );
691693 }
692694
693- if (params -> no_index && !params -> with_zeros )
695+ if (params -> common . hist . no_index && !params -> common . hist . with_zeros )
694696 osnoise_hist_usage ("no-index set and with-zeros not set - it does not make sense" );
695697
696698 return params ;
@@ -729,7 +731,8 @@ static struct osnoise_tool
729731 if (!tool )
730732 return NULL ;
731733
732- tool -> data = osnoise_alloc_histogram (nr_cpus , params -> entries , params -> bucket_size );
734+ tool -> data = osnoise_alloc_histogram (nr_cpus , params -> common .hist .entries ,
735+ params -> common .hist .bucket_size );
733736 if (!tool -> data )
734737 goto out_err ;
735738
0 commit comments