Skip to content

Commit 458c951

Browse files
makelinuxlenticularis39
authored andcommitted
tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu
nr_cpus does not change at runtime, so passing it through the macro argument is unnecessary. Remove the argument and use the global nr_cpus instead. Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20260306194953.2511960-5-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
1 parent caf3fc0 commit 458c951

6 files changed

Lines changed: 20 additions & 21 deletions

File tree

tools/tracing/rtla/src/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct common_params {
110110

111111
extern int nr_cpus;
112112

113-
#define for_each_monitored_cpu(cpu, nr_cpus, common) \
113+
#define for_each_monitored_cpu(cpu, common) \
114114
for (cpu = 0; cpu < nr_cpus; cpu++) \
115115
if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus))
116116

tools/tracing/rtla/src/osnoise_hist.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static void osnoise_hist_header(struct osnoise_tool *tool)
244244
if (!params->common.hist.no_index)
245245
trace_seq_printf(s, "Index");
246246

247-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
247+
for_each_monitored_cpu(cpu, &params->common) {
248248

249249
if (!data->hist[cpu].count)
250250
continue;
@@ -273,8 +273,7 @@ osnoise_print_summary(struct osnoise_params *params,
273273
if (!params->common.hist.no_index)
274274
trace_seq_printf(trace->seq, "count:");
275275

276-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
277-
276+
for_each_monitored_cpu(cpu, &params->common) {
278277
if (!data->hist[cpu].count)
279278
continue;
280279

@@ -285,7 +284,7 @@ osnoise_print_summary(struct osnoise_params *params,
285284
if (!params->common.hist.no_index)
286285
trace_seq_printf(trace->seq, "min: ");
287286

288-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
287+
for_each_monitored_cpu(cpu, &params->common) {
289288

290289
if (!data->hist[cpu].count)
291290
continue;
@@ -298,7 +297,7 @@ osnoise_print_summary(struct osnoise_params *params,
298297
if (!params->common.hist.no_index)
299298
trace_seq_printf(trace->seq, "avg: ");
300299

301-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
300+
for_each_monitored_cpu(cpu, &params->common) {
302301

303302
if (!data->hist[cpu].count)
304303
continue;
@@ -314,7 +313,7 @@ osnoise_print_summary(struct osnoise_params *params,
314313
if (!params->common.hist.no_index)
315314
trace_seq_printf(trace->seq, "max: ");
316315

317-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
316+
for_each_monitored_cpu(cpu, &params->common) {
318317

319318
if (!data->hist[cpu].count)
320319
continue;
@@ -349,7 +348,7 @@ osnoise_print_stats(struct osnoise_tool *tool)
349348
trace_seq_printf(trace->seq, "%-6d",
350349
bucket * data->bucket_size);
351350

352-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
351+
for_each_monitored_cpu(cpu, &params->common) {
353352

354353
if (!data->hist[cpu].count)
355354
continue;
@@ -385,7 +384,7 @@ osnoise_print_stats(struct osnoise_tool *tool)
385384
if (!params->common.hist.no_index)
386385
trace_seq_printf(trace->seq, "over: ");
387386

388-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
387+
for_each_monitored_cpu(cpu, &params->common) {
389388

390389
if (!data->hist[cpu].count)
391390
continue;

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ osnoise_print_stats(struct osnoise_tool *top)
236236

237237
osnoise_top_header(top);
238238

239-
for_each_monitored_cpu(i, nr_cpus, &params->common) {
239+
for_each_monitored_cpu(i, &params->common) {
240240
osnoise_top_print(top, i);
241241
}
242242

tools/tracing/rtla/src/timerlat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int timerlat_enable(struct osnoise_tool *tool)
115115
return -1;
116116
}
117117

118-
for_each_monitored_cpu(i, nr_cpus, &params->common) {
118+
for_each_monitored_cpu(i, &params->common) {
119119
if (save_cpu_idle_disable_state(i) < 0) {
120120
err_msg("Could not save cpu idle state.\n");
121121
return -1;
@@ -218,7 +218,7 @@ void timerlat_free(struct osnoise_tool *tool)
218218
if (dma_latency_fd >= 0)
219219
close(dma_latency_fd);
220220
if (params->deepest_idle_state >= -1) {
221-
for_each_monitored_cpu(i, nr_cpus, &params->common) {
221+
for_each_monitored_cpu(i, &params->common) {
222222
restore_cpu_idle_disable_state(i);
223223
}
224224
}

tools/tracing/rtla/src/timerlat_hist.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *tool)
298298
if (!params->common.hist.no_index)
299299
trace_seq_printf(s, "Index");
300300

301-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
301+
for_each_monitored_cpu(cpu, &params->common) {
302302

303303
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
304304
continue;
@@ -350,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params,
350350
if (!params->common.hist.no_index)
351351
trace_seq_printf(trace->seq, "count:");
352352

353-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
353+
for_each_monitored_cpu(cpu, &params->common) {
354354

355355
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
356356
continue;
@@ -372,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params,
372372
if (!params->common.hist.no_index)
373373
trace_seq_printf(trace->seq, "min: ");
374374

375-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
375+
for_each_monitored_cpu(cpu, &params->common) {
376376

377377
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
378378
continue;
@@ -400,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params,
400400
if (!params->common.hist.no_index)
401401
trace_seq_printf(trace->seq, "avg: ");
402402

403-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
403+
for_each_monitored_cpu(cpu, &params->common) {
404404

405405
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
406406
continue;
@@ -428,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params,
428428
if (!params->common.hist.no_index)
429429
trace_seq_printf(trace->seq, "max: ");
430430

431-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
431+
for_each_monitored_cpu(cpu, &params->common) {
432432

433433
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
434434
continue;
@@ -473,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params,
473473
sum.min_thread = ~0;
474474
sum.min_user = ~0;
475475

476-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
476+
for_each_monitored_cpu(cpu, &params->common) {
477477

478478
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
479479
continue;
@@ -620,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
620620
trace_seq_printf(trace->seq, "%-6d",
621621
bucket * data->bucket_size);
622622

623-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
623+
for_each_monitored_cpu(cpu, &params->common) {
624624

625625
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
626626
continue;
@@ -658,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
658658
if (!params->common.hist.no_index)
659659
trace_seq_printf(trace->seq, "over: ");
660660

661-
for_each_monitored_cpu(cpu, nr_cpus, &params->common) {
661+
for_each_monitored_cpu(cpu, &params->common) {
662662

663663
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
664664
continue;

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ timerlat_print_stats(struct osnoise_tool *top)
446446

447447
timerlat_top_header(params, top);
448448

449-
for_each_monitored_cpu(i, nr_cpus, &params->common) {
449+
for_each_monitored_cpu(i, &params->common) {
450450
timerlat_top_print(top, i);
451451
timerlat_top_update_sum(top, i, &summary);
452452
}

0 commit comments

Comments
 (0)