From: Costa Shulyupin <costa.shul@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Tomas Glozar <tglozar@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Crystal Wood <crwood@redhat.com>,
Wander Lairson Costa <wander@redhat.com>,
Ivan Pravdin <ipravdin.official@gmail.com>,
John Kacur <jkacur@redhat.com>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: [PATCH v2 4/4] tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu
Date: Mon, 9 Feb 2026 11:24:36 +0200 [thread overview]
Message-ID: <20260209092436.2899888-5-costa.shul@redhat.com> (raw)
In-Reply-To: <20260209092436.2899888-1-costa.shul@redhat.com>
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>
---
tools/tracing/rtla/src/common.h | 2 +-
tools/tracing/rtla/src/osnoise_hist.c | 15 +++++++--------
tools/tracing/rtla/src/osnoise_top.c | 2 +-
tools/tracing/rtla/src/timerlat.c | 4 ++--
tools/tracing/rtla/src/timerlat_hist.c | 16 ++++++++--------
tools/tracing/rtla/src/timerlat_top.c | 2 +-
6 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/common.h
index 32f9c1351209..28d258d6d178 100644
--- a/tools/tracing/rtla/src/common.h
+++ b/tools/tracing/rtla/src/common.h
@@ -109,7 +109,7 @@ struct common_params {
extern int nr_cpus;
-#define for_each_monitored_cpu(cpu, nr_cpus, common) \
+#define for_each_monitored_cpu(cpu, common) \
for (cpu = 0; cpu < nr_cpus; cpu++) \
if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus))
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 90291504a1aa..e8f07108d39a 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -244,7 +244,7 @@ static void osnoise_hist_header(struct osnoise_tool *tool)
if (!params->common.hist.no_index)
trace_seq_printf(s, "Index");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -273,8 +273,7 @@ osnoise_print_summary(struct osnoise_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "count:");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
-
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -285,7 +284,7 @@ osnoise_print_summary(struct osnoise_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "min: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -298,7 +297,7 @@ osnoise_print_summary(struct osnoise_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "avg: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -314,7 +313,7 @@ osnoise_print_summary(struct osnoise_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "max: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -349,7 +348,7 @@ osnoise_print_stats(struct osnoise_tool *tool)
trace_seq_printf(trace->seq, "%-6d",
bucket * data->bucket_size);
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
@@ -385,7 +384,7 @@ osnoise_print_stats(struct osnoise_tool *tool)
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "over: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].count)
continue;
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 6fb3e72d74f2..ab5db35f21ae 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -236,7 +236,7 @@ osnoise_print_stats(struct osnoise_tool *top)
osnoise_top_header(top);
- for_each_monitored_cpu(i, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(i, ¶ms->common) {
osnoise_top_print(top, i);
}
diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/timerlat.c
index 69856f677fce..ec14abd45fff 100644
--- a/tools/tracing/rtla/src/timerlat.c
+++ b/tools/tracing/rtla/src/timerlat.c
@@ -115,7 +115,7 @@ int timerlat_enable(struct osnoise_tool *tool)
return -1;
}
- for_each_monitored_cpu(i, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(i, ¶ms->common) {
if (save_cpu_idle_disable_state(i) < 0) {
err_msg("Could not save cpu idle state.\n");
return -1;
@@ -218,7 +218,7 @@ void timerlat_free(struct osnoise_tool *tool)
if (dma_latency_fd >= 0)
close(dma_latency_fd);
if (params->deepest_idle_state >= -1) {
- for_each_monitored_cpu(i, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(i, ¶ms->common) {
restore_cpu_idle_disable_state(i);
}
}
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 4bf1489cad23..db66312ec966 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -298,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *tool)
if (!params->common.hist.no_index)
trace_seq_printf(s, "Index");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -350,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "count:");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -372,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "min: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -400,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "avg: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -428,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params,
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "max: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -473,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params,
sum.min_thread = ~0;
sum.min_user = ~0;
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -620,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
trace_seq_printf(trace->seq, "%-6d",
bucket * data->bucket_size);
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
@@ -658,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool)
if (!params->common.hist.no_index)
trace_seq_printf(trace->seq, "over: ");
- for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(cpu, ¶ms->common) {
if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
continue;
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 4eb820fe1f21..ed3d3d1c8956 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -446,7 +446,7 @@ timerlat_print_stats(struct osnoise_tool *top)
timerlat_top_header(params, top);
- for_each_monitored_cpu(i, nr_cpus, ¶ms->common) {
+ for_each_monitored_cpu(i, ¶ms->common) {
timerlat_top_print(top, i);
timerlat_top_update_sum(top, i, &summary);
}
--
2.52.0
next prev parent reply other threads:[~2026-02-09 9:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 9:24 [PATCH v2 0/4] tools/rtla: Consolidate nr_cpus usage Costa Shulyupin
2026-02-09 9:24 ` [PATCH v2 1/4] tools/rtla: Consolidate nr_cpus usage across all tools Costa Shulyupin
2026-02-11 11:03 ` Wander Lairson Costa
2026-02-11 11:15 ` Tomas Glozar
2026-02-09 9:24 ` [PATCH v2 2/4] tools/rtla: Remove unneeded nr_cpus arguments Costa Shulyupin
2026-02-11 11:03 ` Wander Lairson Costa
2026-02-09 9:24 ` [PATCH v2 3/4] tools/rtla: Remove unneeded nr_cpus members Costa Shulyupin
2026-02-09 9:24 ` Costa Shulyupin [this message]
2026-02-10 21:07 ` [PATCH v2 0/4] tools/rtla: Consolidate nr_cpus usage Crystal Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260209092436.2899888-5-costa.shul@redhat.com \
--to=costa.shul@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=crwood@redhat.com \
--cc=ipravdin.official@gmail.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=wander@redhat.com \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox