From nobody Thu Apr 2 20:20:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F000F145355 for ; Fri, 6 Mar 2026 19:54:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826859; cv=none; b=jZwHh8Q9RFmi0NeANUbqLVtvuDgayUbyiY6iFUkmmAWl+eh9rBgC831TLas50Nz9tXUcnVXnwd7RQ6SKvZhj/rdxf17C3gszD3SZyb5WruLDGRTeMk8mapMTyZYGkV0B43UySDD+PA13zBWeDbngxasztutO6u+VtxG9g4E+ZzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826859; c=relaxed/simple; bh=S/SKHxHdcMr1QfdvIXxApGtmWBodmKNCEKaTN0iTkn4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=shPrwXZwdGDJWa/xXpN4yff6835C1kIpsJTiz+lPXrTog884B8twZE0KBgrso5ydYHFFPyaXKABK7RnBeTIWYZeRxT/s7ZpWKbl9Fi750SvBU8YG0HZoYfeb+f1cF8e2qOTlFgrJp7IYzt+/mk7vsGASEZizJ9fM0U6dJLlg/IU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=J2/S4FSj; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=etXIFe8W; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J2/S4FSj"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="etXIFe8W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772826857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UCk5SXr8JRhBJjx3kalF2SaqtbteDwoDGZPqMuj8Nbw=; b=J2/S4FSjas95SyW2OxxxmyILUMNKrQxuHd+kbY1sMDQ7/NZZENyeFpAY/A3ox968Lq824E lTYHwH3YTdWpkvE98iSqau54OqL6kvpukT3AgVd8U08v9QyQX4odcw/koXUBfHySLYuvcV HQIzSs8883gbPx/5B0+gEE6TQ40Y/YE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-64JkIft7MjG_yUCAF5RhOw-1; Fri, 06 Mar 2026 14:54:15 -0500 X-MC-Unique: 64JkIft7MjG_yUCAF5RhOw-1 X-Mimecast-MFC-AGG-ID: 64JkIft7MjG_yUCAF5RhOw_1772826855 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-48378df3469so68408865e9.1 for ; Fri, 06 Mar 2026 11:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772826855; x=1773431655; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UCk5SXr8JRhBJjx3kalF2SaqtbteDwoDGZPqMuj8Nbw=; b=etXIFe8WHe+NORyTymg945Qp6Bk4lvpPVZt76ufM01Zx+8jr0sdx23WDaDCgtSOINc ujiiuO9QR9OaCwcPloUFM7FI+WF2IOZL/+VYanh2pSgTbLiGr+svY69NEcnsA1YiAhRI g7wwB506J78Wi0aAeAjoaSWvBefMfLOEimLRE/WNRbSFozVu1A95h7FvhfkV/nSrVmA9 pc/2Ptwsokhzio7A3Wkog/pcZwNOJCMvrsfsoSLJQKeTvJEK+/UuSkJ7bkS6SgruXyEp u4ifXTZ5j4xro9A7twMvZUZt7Oc4kM/YjIMAF1Oi6OtTld7M9yQqTdNJFMrvWOS5DJSl xTeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772826855; x=1773431655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UCk5SXr8JRhBJjx3kalF2SaqtbteDwoDGZPqMuj8Nbw=; b=gWwK+AT7x4qoMDhvc7S6JRxYKIbGugWHfovCXdIlfaILESQaFNe9rmBAIG0heUHjWn YZTdjhkUqsdPLEtN6vVGa6yAXPGjFQTy4RFuHxFSnzOsO0LGb1ZDqZFeMNxpbEYxvJO7 +QMBLJHCI7NfiDqKryyNPCmPJc3LODUntO/kTr5jDU6f1Q/iyVgFT5pODjEP1AT17LHt 3l4Z1wlP/sDtXGe7fdKyaiyzAL2ywi9oX4yqsN+KgSodYCl/1xhD40Pf0pJxjjz536Wq 1wN/v1Jt6FBZeJoXpq4VTyGfK0FjcAPdyN8aZYKw2fi7XMDb7X+YGucytdo+4TQvuTF/ wl3g== X-Forwarded-Encrypted: i=1; AJvYcCVkLHQNlD3nluIS7bHYYw7L4Go8KCQtJf8gQKv28DT3SOGRQBtK+e/BEo63V4Oj2BeyhW46elNSycvVtxg=@vger.kernel.org X-Gm-Message-State: AOJu0YxxHW32sHhNGMlxnnjzENZDDO9O9vvsBGONlNcBGuH0E2vi8or/ VPaZinlY7TFmx31V6t1rsfUgjxArk9GTO5H5xMhjAR3Is7rHXLdTe/1DDlnHxLWw4yKD59oU6v6 js9XOribYcsa1g04yGax4YfRlbwOL1lcT4p/ZTssPaes1Wf97ruuIk/rywd+76Qia7A== X-Gm-Gg: ATEYQzzHDfmh7CP0r33q/GFe5actt4fAG2p+BoLkR6b33xOTxSDBnB1ew9ODOSms1+Z oi0j1auikV6NYxZzb99MEu5YfZxnSeM/W6LbbnsdnrauJF4gPLgxUf0pPlcNSo775LfesguE+Om AUj/GnAlBIvnHi5X13kwSNiz18oICt0XQtAR6DCF9ToEeFR/UglsFg3+VRBrDuyhelTEfADZ/Mh AIkxz9k+Imoc7hgevnrvBjI1Uvxg1V/dvTjOB0zmar3k0tNu2kZffExZlBgmJ0OfCL5+2Z6U31b eZ26XHj1hsOrBoGhVU4mpAzE0BR9jiqAoSF3s+/l9wlcSaHlXTY/hQITV20yT0Z1SmDXITgys6+ PryoKxR1/5ZHrS96gU/sDHt+X2CS5mNtoIgNsKA== X-Received: by 2002:a05:600c:3147:b0:481:a662:b3f3 with SMTP id 5b1f17b1804b1-4852671cbebmr51861255e9.7.1772826854483; Fri, 06 Mar 2026 11:54:14 -0800 (PST) X-Received: by 2002:a05:600c:3147:b0:481:a662:b3f3 with SMTP id 5b1f17b1804b1-4852671cbebmr51860805e9.7.1772826853882; Fri, 06 Mar 2026 11:54:13 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b75eesm48596485e9.14.2026.03.06.11.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:54:13 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , John Kacur , Ivan Pravdin , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 1/4] tools/rtla: Consolidate nr_cpus usage across all tools Date: Fri, 6 Mar 2026 21:49:49 +0200 Message-ID: <20260306194953.2511960-2-costa.shul@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260306194953.2511960-1-costa.shul@redhat.com> References: <20260306194953.2511960-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sysconf(_SC_NPROCESSORS_CONF) (via get_nprocs_conf) reflects cpu_possible_mask, which is fixed at boot time, so querying it repeatedly is unnecessary. Replace multiple calls to sysconf(_SC_NPROCESSORS_CONF) with a single global nr_cpus variable initialized once at startup. `#pragma once` in timerlat_u.h is needed for pre-C23 compilers to avoid redefinition errors. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/common.c | 7 +++- tools/tracing/rtla/src/common.h | 2 + tools/tracing/rtla/src/osnoise_hist.c | 3 -- tools/tracing/rtla/src/osnoise_top.c | 7 ---- tools/tracing/rtla/src/timerlat.c | 5 +-- tools/tracing/rtla/src/timerlat_aa.c | 1 - tools/tracing/rtla/src/timerlat_hist.c | 3 -- tools/tracing/rtla/src/timerlat_top.c | 7 ---- tools/tracing/rtla/src/timerlat_u.c | 3 +- tools/tracing/rtla/src/timerlat_u.h | 1 + tools/tracing/rtla/src/utils.c | 10 +---- tools/tracing/rtla/tests/unit/unit_tests.c | 44 ++++++++++------------ 12 files changed, 31 insertions(+), 62 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index f310b0d59ad3..a31fbaea5da6 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -5,12 +5,14 @@ #include #include #include -#include #include +#include + #include "common.h" =20 struct trace_instance *trace_inst; volatile int stop_tracing; +int nr_cpus; =20 static void stop_trace(int sig) { @@ -165,7 +167,7 @@ common_apply_config(struct osnoise_tool *tool, struct c= ommon_params *params) } =20 if (!params->cpus) { - for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) + for (i =3D 0; i < nr_cpus; i++) CPU_SET(i, ¶ms->monitored_cpus); } =20 @@ -213,6 +215,7 @@ int run_tool(struct tool_ops *ops, int argc, char *argv= []) bool stopped; int retval; =20 + nr_cpus =3D get_nprocs_conf(); params =3D ops->parse_args(argc, argv); if (!params) exit(1); diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/commo= n.h index d4b3715700be..90a3c0d1dbf3 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -108,6 +108,8 @@ struct common_params { struct timerlat_u_params user; }; =20 +extern int nr_cpus; + #define for_each_monitored_cpu(cpu, nr_cpus, common) \ for (cpu =3D 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 5c863e7aad28..00b8c95cbf85 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -646,9 +646,6 @@ static struct osnoise_tool *osnoise_init_hist(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("osnoise_hist"); if (!tool) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index b7aed40fd216..9a6cd9a2470a 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -232,12 +232,8 @@ osnoise_print_stats(struct osnoise_tool *top) { struct osnoise_params *params =3D to_osnoise_params(top->params); struct trace_instance *trace =3D &top->trace; - static int nr_cpus =3D -1; int i; =20 - if (nr_cpus =3D=3D -1) - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - if (!params->common.quiet) clear_terminal(trace->seq); =20 @@ -494,9 +490,6 @@ osnoise_top_apply_config(struct osnoise_tool *tool) struct osnoise_tool *osnoise_init_top(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("osnoise_top"); if (!tool) diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 9e4daed0aafc..31c921efa7c1 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -99,7 +99,7 @@ timerlat_apply_config(struct osnoise_tool *tool, struct t= imerlat_params *params) int timerlat_enable(struct osnoise_tool *tool) { struct timerlat_params *params =3D to_timerlat_params(tool->params); - int retval, nr_cpus, i; + int retval, i; =20 if (params->dma_latency >=3D 0) { dma_latency_fd =3D set_cpu_dma_latency(params->dma_latency); @@ -115,8 +115,6 @@ int timerlat_enable(struct osnoise_tool *tool) return -1; } =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { if (save_cpu_idle_disable_state(i) < 0) { err_msg("Could not save cpu idle state.\n"); @@ -214,7 +212,6 @@ void timerlat_analyze(struct osnoise_tool *tool, bool s= topped) void timerlat_free(struct osnoise_tool *tool) { struct timerlat_params *params =3D to_timerlat_params(tool->params); - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); int i; =20 timerlat_aa_destroy(); diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/= timerlat_aa.c index 178de60dcef9..095483375823 100644 --- a/tools/tracing/rtla/src/timerlat_aa.c +++ b/tools/tracing/rtla/src/timerlat_aa.c @@ -1043,7 +1043,6 @@ void timerlat_aa_destroy(void) */ int timerlat_aa_init(struct osnoise_tool *tool, int dump_tasks, enum stack= _format stack_format) { - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); struct timerlat_aa_context *taa_ctx; int retval; =20 diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 88211e54bc9d..3ebe41eed9f6 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -1040,9 +1040,6 @@ static struct osnoise_tool *timerlat_init_hist(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("timerlat_hist"); if (!tool) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 7a00f3844f56..4105638f45c4 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -442,15 +442,11 @@ timerlat_print_stats(struct osnoise_tool *top) struct timerlat_params *params =3D to_timerlat_params(top->params); struct trace_instance *trace =3D &top->trace; struct timerlat_top_cpu summary; - static int nr_cpus =3D -1; int i; =20 if (params->common.aa_only) return; =20 - if (nr_cpus =3D=3D -1) - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - if (!params->common.quiet) clear_terminal(trace->seq); =20 @@ -790,9 +786,6 @@ static struct osnoise_tool *timerlat_init_top(struct common_params *params) { struct osnoise_tool *top; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 top =3D osnoise_init_tool("timerlat_top"); if (!top) diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/t= imerlat_u.c index ce68e39d25fd..a569fe7f93aa 100644 --- a/tools/tracing/rtla/src/timerlat_u.c +++ b/tools/tracing/rtla/src/timerlat_u.c @@ -16,7 +16,7 @@ #include #include =20 -#include "utils.h" +#include "common.h" #include "timerlat_u.h" =20 /* @@ -131,7 +131,6 @@ static int timerlat_u_send_kill(pid_t *procs, int nr_cp= us) */ void *timerlat_u_dispatcher(void *data) { - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); struct timerlat_u_params *params =3D data; char proc_name[128]; int procs_count =3D 0; diff --git a/tools/tracing/rtla/src/timerlat_u.h b/tools/tracing/rtla/src/t= imerlat_u.h index 661511908957..a692331bd1c7 100644 --- a/tools/tracing/rtla/src/timerlat_u.h +++ b/tools/tracing/rtla/src/timerlat_u.h @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#pragma once /* * Copyright (C) 2023 Red Hat Inc, Daniel Bristot de Oliveira */ diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index d979159f6b70..77593718766a 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -19,7 +19,7 @@ #include #include =20 -#include "utils.h" +#include "common.h" =20 #define MAX_MSG_LENGTH 1024 int config_debug; @@ -119,14 +119,11 @@ int parse_cpu_set(char *cpu_list, cpu_set_t *set) { const char *p; int end_cpu; - int nr_cpus; int cpu; int i; =20 CPU_ZERO(set); =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for (p =3D cpu_list; *p; ) { cpu =3D atoi(p); if (cpu < 0 || (!cpu && *p !=3D '0') || cpu >=3D nr_cpus) @@ -577,7 +574,6 @@ int save_cpu_idle_disable_state(unsigned int cpu) unsigned int nr_states; unsigned int state; int disabled; - int nr_cpus; =20 nr_states =3D cpuidle_state_count(cpu); =20 @@ -585,7 +581,6 @@ int save_cpu_idle_disable_state(unsigned int cpu) return 0; =20 if (saved_cpu_idle_disable_state =3D=3D NULL) { - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); saved_cpu_idle_disable_state =3D calloc(nr_cpus, sizeof(unsigned int *)); if (!saved_cpu_idle_disable_state) return -1; @@ -662,13 +657,10 @@ int restore_cpu_idle_disable_state(unsigned int cpu) void free_cpu_idle_disable_states(void) { int cpu; - int nr_cpus; =20 if (!saved_cpu_idle_disable_state) return; =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for (cpu =3D 0; cpu < nr_cpus; cpu++) { free(saved_cpu_idle_disable_state[cpu]); saved_cpu_idle_disable_state[cpu] =3D NULL; diff --git a/tools/tracing/rtla/tests/unit/unit_tests.c b/tools/tracing/rtl= a/tests/unit/unit_tests.c index aa53f8605e36..f3c6d89e3300 100644 --- a/tools/tracing/rtla/tests/unit/unit_tests.c +++ b/tools/tracing/rtla/tests/unit/unit_tests.c @@ -7,8 +7,10 @@ #include #include #include +#include =20 #include "../../src/utils.h" +int nr_cpus; =20 START_TEST(test_strtoi) { @@ -34,35 +36,29 @@ END_TEST START_TEST(test_parse_cpu_set) { cpu_set_t set; - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 + nr_cpus =3D 8; ck_assert_int_eq(parse_cpu_set("0", &set), 0); ck_assert(CPU_ISSET(0, &set)); ck_assert(!CPU_ISSET(1, &set)); =20 - if (nr_cpus > 2) { - ck_assert_int_eq(parse_cpu_set("0,2", &set), 0); - ck_assert(CPU_ISSET(0, &set)); - ck_assert(CPU_ISSET(2, &set)); - } - - if (nr_cpus > 3) { - ck_assert_int_eq(parse_cpu_set("0-3", &set), 0); - ck_assert(CPU_ISSET(0, &set)); - ck_assert(CPU_ISSET(1, &set)); - ck_assert(CPU_ISSET(2, &set)); - ck_assert(CPU_ISSET(3, &set)); - } - - if (nr_cpus > 5) { - ck_assert_int_eq(parse_cpu_set("1-3,5", &set), 0); - ck_assert(!CPU_ISSET(0, &set)); - ck_assert(CPU_ISSET(1, &set)); - ck_assert(CPU_ISSET(2, &set)); - ck_assert(CPU_ISSET(3, &set)); - ck_assert(!CPU_ISSET(4, &set)); - ck_assert(CPU_ISSET(5, &set)); - } + ck_assert_int_eq(parse_cpu_set("0,2", &set), 0); + ck_assert(CPU_ISSET(0, &set)); + ck_assert(CPU_ISSET(2, &set)); + + ck_assert_int_eq(parse_cpu_set("0-3", &set), 0); + ck_assert(CPU_ISSET(0, &set)); + ck_assert(CPU_ISSET(1, &set)); + ck_assert(CPU_ISSET(2, &set)); + ck_assert(CPU_ISSET(3, &set)); + + ck_assert_int_eq(parse_cpu_set("1-3,5", &set), 0); + ck_assert(!CPU_ISSET(0, &set)); + ck_assert(CPU_ISSET(1, &set)); + ck_assert(CPU_ISSET(2, &set)); + ck_assert(CPU_ISSET(3, &set)); + ck_assert(!CPU_ISSET(4, &set)); + ck_assert(CPU_ISSET(5, &set)); =20 ck_assert_int_eq(parse_cpu_set("-1", &set), 1); ck_assert_int_eq(parse_cpu_set("abc", &set), 1); --=20 2.53.0 From nobody Thu Apr 2 20:20:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22A874301B3 for ; Fri, 6 Mar 2026 19:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826863; cv=none; b=etUie9ZeyW3Hc+FssTOcvyJ7AeaCjwtrj+Enua5J1VblS5+PnI6Lo0lXuqwMkdv230T81QLDTayHLryhoq3wBjLhme9k/W0fGjcY5bemM+AqQWfkQveNgbI6vLPwSuyrhl41OM3XGz6hg73axkMWUURQMp63SeN/UAg8DIMNzUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826863; c=relaxed/simple; bh=eIx0WUCThzc1Mhd7tZA/tvw0jMl5/Z7DBQ1leSDTcY8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PtHSuWAHIXb8jaQc+mHbANLN9ESIClsAPI205j/T5giuwdRtqXCy413ZWd7hcfzUNT5H4MDYHL9B1SiG2LGgcZ65pjaASYrDW3Xh2yoEz1pNqfI7081I9uGPPvXQj43cSIbIsOCGiMohxdinfI0JWaxW+PAeARliF6JIl0/o/uQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UEzZ6xPc; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RbtelPOX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UEzZ6xPc"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RbtelPOX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772826861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=UEzZ6xPcAZ4ua97YTf7x5bIzFhB3DkXNiGVH3qv94Z9ZUqreVpYIJaitafFH9Q0sKpZ9iH xxc6pEj+TcdFnfmi9HmC6OnlbXXDUMKlUxGSnJlEM3kmKw2ose+igkgrmmZCn3iE27ZsMS eWjXpODXQ3HnusY0SRc7I5aVpFBkU80= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481--Rq_yd6IONmGzTIJji_png-1; Fri, 06 Mar 2026 14:54:20 -0500 X-MC-Unique: -Rq_yd6IONmGzTIJji_png-1 X-Mimecast-MFC-AGG-ID: -Rq_yd6IONmGzTIJji_png_1772826859 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-48379489438so95919625e9.2 for ; Fri, 06 Mar 2026 11:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772826859; x=1773431659; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=RbtelPOXNaIl5isfcx0WE/oYJUNLEyT4IwOwsnUf3lTsWMpmrv9rPZG7LAxw6GhiHy 3AT3GUM8rv58LP6xmx5tqj52uCrBs0z4WXGN4T4ter5OzA+LKenB4CzvjX1qZf0/dOtk JNxTUsMOGTxUcF/UP1sccdMQcZI+glsYZe5GFp6grQNapT3U8tKVg2G3RYejPxNS6k1u LtLt1j5FNDVK/ySXYKjPzIXZOhdkp81NIvCux52TMqv110xYK0Sod5hcRJHPnNHTEQUA Xq6x2IoY8c+tZK7x2iaBDXjTdL2FyKcDNL7bwcrBMjWdzR9l+rnSZ40tyTIqR10Zzy4U hXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772826859; x=1773431659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=MiDA8ZYkRnmcS8czhPabkVUQ79moGkHyHZcr0gbV4Z+HI6P9k1GH5uQVsUdXfSiS/g pfj2jXuEUd2V8a31Xb9EJ+5j8c00lPDm++5GrWG3iJgJvSMOooyOtRJzjOtBpp7i2GsT n6XoIDsZcz9FcaKLdAyHgC/QED0Dt0MBL1VezFPlL+he/ZnYQy0vrWxYVP1w+MOBYgjz XgRiMG88umUh/ERfh6q2ZQ2pl9A7Ek4/FuOnwGp8+SVDaaQ+vdGRm51uOl7BOivhSxth JxeJsi1mlxCbmxYJpISLkOfkj6HSBv4pq+0alV/ouoPISb1qG4R9qXodKvGW7JshwD4q 73AQ== X-Forwarded-Encrypted: i=1; AJvYcCVgLpsY6SrF4kFPJhahNUKmiDObinQYfGkeoGqIYCZholGHtdhGEog4oFTuRRwaZ0X1AXd8RsP5uLtTYMQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzFpeaCUzGLK0iNMYAypmF4gRzUFOGwfWSS+nSYpO4CHbwUyFsq LDqd0mkI+zU41985wsVLO+i02kkWXiI5GXCqoIh8Y/s+QkzMp1FGqrjuSm4kjR/CwgEEEVzOZPu 2B1GLCZkXh99sA5DuF2GRnY322krlmWtN8Btzlf0VIqP3mpBdn8i6X+vc/2J8yKG4Pw== X-Gm-Gg: ATEYQzxRNMoX4XmOONcpD2oSHoftc3MfcAcJRRITtH6GmzpfyKVrV0AMvvagDMOP7zx hxkPj9d6CSTQlOpLcJO/q5aC/cTM07gg2W/HnsH326g3TQagd7NfpJGcson7vTJ78iUH2PuyTAF iHD/5ZTTog+BlndioD+NH3H84kx8M81iIklPpgv3Mp8MjtpPX4Q7/vRnVGW7qyoxOTR0Rq2Ccwp hiQeUYCj4AGTuRTCsSlqpAnH3cjQ5b5fpjPb9b2p1GsxlRhfwBaC8WK6psPChYHVf1oUaP2XICc 4QehlKHpxxESQLXc5UX/KdW/L3aXr5JR5TjzINtMQ3A1JifJ5zjrRHA4Zl31EN6lhQ6qk/i95ZX rR5KUBdubDTh56rN+GPV/htulhcn4ah4acja4mQ== X-Received: by 2002:a05:600c:c088:b0:483:79a6:e7e1 with SMTP id 5b1f17b1804b1-48526919935mr51129795e9.7.1772826858732; Fri, 06 Mar 2026 11:54:18 -0800 (PST) X-Received: by 2002:a05:600c:c088:b0:483:79a6:e7e1 with SMTP id 5b1f17b1804b1-48526919935mr51129545e9.7.1772826858229; Fri, 06 Mar 2026 11:54:18 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b75eesm48596485e9.14.2026.03.06.11.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:54:17 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , John Kacur , Ivan Pravdin , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 2/4] tools/rtla: Remove unneeded nr_cpus arguments Date: Fri, 6 Mar 2026 21:49:50 +0200 Message-ID: <20260306194953.2511960-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260306194953.2511960-1-costa.shul@redhat.com> References: <20260306194953.2511960-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nr_cpus does not change at runtime, so passing it through function arguments is unnecessary. Use the global nr_cpus instead of propagating it via parameters. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 4 ++-- tools/tracing/rtla/src/osnoise_top.c | 4 ++-- tools/tracing/rtla/src/timerlat_bpf.c | 19 ++++++++----------- tools/tracing/rtla/src/timerlat_bpf.h | 12 ++++-------- tools/tracing/rtla/src/timerlat_hist.c | 21 ++++++++------------- tools/tracing/rtla/src/timerlat_top.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_u.c | 6 +++--- 7 files changed, 34 insertions(+), 51 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 00b8c95cbf85..f39f60d3b00e 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -62,7 +62,7 @@ static void osnoise_free_hist_tool(struct osnoise_tool *t= ool) * osnoise_alloc_histogram - alloc runtime data */ static struct osnoise_hist_data -*osnoise_alloc_histogram(int nr_cpus, int entries, int bucket_size) +*osnoise_alloc_histogram(int entries, int bucket_size) { struct osnoise_hist_data *data; int cpu; @@ -651,7 +651,7 @@ static struct osnoise_tool if (!tool) return NULL; =20 - tool->data =3D osnoise_alloc_histogram(nr_cpus, params->hist.entries, + tool->data =3D osnoise_alloc_histogram(params->hist.entries, params->hist.bucket_size); if (!tool->data) goto out_err; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 9a6cd9a2470a..3a241b69f622 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -51,7 +51,7 @@ static void osnoise_free_top_tool(struct osnoise_tool *to= ol) /* * osnoise_alloc_histogram - alloc runtime data */ -static struct osnoise_top_data *osnoise_alloc_top(int nr_cpus) +static struct osnoise_top_data *osnoise_alloc_top(void) { struct osnoise_top_data *data; =20 @@ -495,7 +495,7 @@ struct osnoise_tool *osnoise_init_top(struct common_par= ams *params) if (!tool) return NULL; =20 - tool->data =3D osnoise_alloc_top(nr_cpus); + tool->data =3D osnoise_alloc_top(); if (!tool->data) { osnoise_destroy_tool(tool); return NULL; diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src= /timerlat_bpf.c index 05adf18303df..dd3cf71d74e5 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -147,24 +147,23 @@ static int get_value(struct bpf_map *map_irq, int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { int err; =20 err =3D bpf_map__lookup_elem(map_irq, &key, sizeof(unsigned int), value_irq, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; err =3D bpf_map__lookup_elem(map_thread, &key, sizeof(unsigned int), value_thread, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; err =3D bpf_map__lookup_elem(map_user, &key, sizeof(unsigned int), value_user, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; return 0; @@ -176,13 +175,12 @@ static int get_value(struct bpf_map *map_irq, int timerlat_bpf_get_hist_value(int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return get_value(bpf->maps.hist_irq, bpf->maps.hist_thread, bpf->maps.hist_user, - key, value_irq, value_thread, value_user, cpus); + key, value_irq, value_thread, value_user); } =20 /* @@ -191,13 +189,12 @@ int timerlat_bpf_get_hist_value(int key, int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return get_value(bpf->maps.summary_irq, bpf->maps.summary_thread, bpf->maps.summary_user, - key, value_irq, value_thread, value_user, cpus); + key, value_irq, value_thread, value_user); } =20 /* diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index 169abeaf4363..531c9ef16f51 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -23,13 +23,11 @@ int timerlat_bpf_restart_tracing(void); int timerlat_bpf_get_hist_value(int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus); + long long *value_user); int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus); + long long *value_user); int timerlat_load_bpf_action_program(const char *program_path); static inline int have_libbpf_support(void) { return 1; } #else @@ -45,16 +43,14 @@ static inline int timerlat_bpf_restart_tracing(void) { = return -1; }; static inline int timerlat_bpf_get_hist_value(int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return -1; } static inline int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return -1; } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 3ebe41eed9f6..7e735b62488c 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -83,7 +83,7 @@ static void timerlat_free_histogram_tool(struct osnoise_t= ool *tool) * timerlat_alloc_histogram - alloc runtime data */ static struct timerlat_hist_data -*timerlat_alloc_histogram(int nr_cpus, int entries, int bucket_size) +*timerlat_alloc_histogram(int entries, int bucket_size) { struct timerlat_hist_data *data; int cpu; @@ -211,7 +211,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) /* Pull histogram */ for (i =3D 0; i < data->entries; i++) { err =3D timerlat_bpf_get_hist_value(i, value_irq, value_thread, - value_user, data->nr_cpus); + value_user); if (err) return err; for (j =3D 0; j < data->nr_cpus; j++) { @@ -223,8 +223,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_COUNT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -234,8 +233,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MIN, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -245,8 +243,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MAX, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -256,8 +253,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_SUM, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -267,8 +263,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_OVERFLOW, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -1045,7 +1040,7 @@ static struct osnoise_tool if (!tool) return NULL; =20 - tool->data =3D timerlat_alloc_histogram(nr_cpus, params->hist.entries, + tool->data =3D timerlat_alloc_histogram(params->hist.entries, params->hist.bucket_size); if (!tool->data) goto out_err; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 4105638f45c4..994e89a57cd3 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -62,7 +62,7 @@ static void timerlat_free_top_tool(struct osnoise_tool *t= ool) /* * timerlat_alloc_histogram - alloc runtime data */ -static struct timerlat_top_data *timerlat_alloc_top(int nr_cpus) +static struct timerlat_top_data *timerlat_alloc_top(void) { struct timerlat_top_data *data; int cpu; @@ -196,8 +196,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_CURRENT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -207,8 +206,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_COUNT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -218,8 +216,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MIN, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -229,8 +226,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MAX, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -240,8 +236,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_SUM, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -791,7 +786,7 @@ static struct osnoise_tool if (!top) return NULL; =20 - top->data =3D timerlat_alloc_top(nr_cpus); + top->data =3D timerlat_alloc_top(); if (!top->data) goto out_err; =20 diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/t= imerlat_u.c index a569fe7f93aa..03b4e68e8b1e 100644 --- a/tools/tracing/rtla/src/timerlat_u.c +++ b/tools/tracing/rtla/src/timerlat_u.c @@ -99,7 +99,7 @@ static int timerlat_u_main(int cpu, struct timerlat_u_par= ams *params) * * Return the number of processes that received the kill. */ -static int timerlat_u_send_kill(pid_t *procs, int nr_cpus) +static int timerlat_u_send_kill(pid_t *procs) { int killed =3D 0; int i, retval; @@ -169,7 +169,7 @@ void *timerlat_u_dispatcher(void *data) =20 /* parent */ if (pid =3D=3D -1) { - timerlat_u_send_kill(procs, nr_cpus); + timerlat_u_send_kill(procs); debug_msg("Failed to create child processes"); pthread_exit(&retval); } @@ -196,7 +196,7 @@ void *timerlat_u_dispatcher(void *data) sleep(1); } =20 - timerlat_u_send_kill(procs, nr_cpus); + timerlat_u_send_kill(procs); =20 while (procs_count) { pid =3D waitpid(-1, &wstatus, 0); --=20 2.53.0 From nobody Thu Apr 2 20:20:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08B2A430BB3 for ; Fri, 6 Mar 2026 19:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826869; cv=none; b=X1uwlOBmGDdJqIGtTsDsop9wVG8oVDEDaUU8vqWTpoR2qKLmIokYY53OTtUxyhynqVWvYYG7gogwIgHB0r/d1fnJRN3Xv8Xs/84OXGD6vmqUhdsqg6cLhojOG68sKb6/Xj2kmyWSoVEypRUtCwS+M0ILBssJ2gxkxxFg1QhfOFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826869; c=relaxed/simple; bh=6to0dfrAh3XjTCSonSgtXalBKtCubLPLIEWU1ztAl+A=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=urWo3NDzQWUdgNyJbNINCEn4GFE6rF7n3/k/A/LQyCcWdL6/gAXbBdXOtSbZsmzS3uWosUWsNVaQ7N2DG2Og4Y1DInQ7am1tYP2bDShGIu5tr6QIMshrJP5rO1eZM+46Bu8UdfeCi6uWBMCzibZdwzf+Cz7I3wPm7x7fBnI3cPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZXD6/zyJ; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=JAfDRa6Y; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZXD6/zyJ"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="JAfDRa6Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772826867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zVtg1Z0m8Jaq2J1pJ1SVX/vA+T31djcwB6wnVu1yPyc=; b=ZXD6/zyJEUSmqSn4vCuf8XNHAyJTHBWwVKDHylDATLignLL5WUFPDeVhxsyDpCwh3uFOh8 ElkIU2EDX8bqYb0gKqzV3xPm0WysBaY8A6OjZ/X7mh+pr3BWpujt0cjj4ksJ9ja/Kx7Fgo eLwpDvZA/iGE0wE/15jpEKUMLYFyJ/Y= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-MGxJ_xdNPb2A9k12SqQQ7w-1; Fri, 06 Mar 2026 14:54:24 -0500 X-MC-Unique: MGxJ_xdNPb2A9k12SqQQ7w-1 X-Mimecast-MFC-AGG-ID: MGxJ_xdNPb2A9k12SqQQ7w_1772826862 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48372facfedso85556945e9.0 for ; Fri, 06 Mar 2026 11:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772826862; x=1773431662; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zVtg1Z0m8Jaq2J1pJ1SVX/vA+T31djcwB6wnVu1yPyc=; b=JAfDRa6Y5mk71R+o2i7fYCfokGC3VaMdjMDcciSN6Z2a8PrwFm38WG8ZAJ7X/6ijQN +L0neHoN4c7PXPcCB3I9xekSmko0q8M8XtWnlXcw0bvBiVM+1+z6hvwXRoHG2vcGEfGC y2SoNaGunKdELtnDTr7Y8gw+mojmDMB+ceTz1eYO5+vWOJpISqeb6SrPJmRsu1mQluoo kbmv5ayU0j/IOzLtQCG3fsEoiF2KQEKhFPAZuMB85axgk88HhTP9UiNrrugY0nneZE8f EOQ+i+4uTrBJ80f1HrTtNyouy1sVYgDAO4j4smz8hpP5mxv3llmniBQtaGRUJsjI6gR1 hKZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772826862; x=1773431662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zVtg1Z0m8Jaq2J1pJ1SVX/vA+T31djcwB6wnVu1yPyc=; b=fhnVFyWsngU0M8YiWCNJB0Q4NnCxVrg8hD7SCBLoGmhV1cMQIEJaZyeLMoYQeDoKA4 nwGABmjevNuIILpv1BN8CMEm9Y4W1+uIFUiBtms+xoFtIgr0CLWbeXIzEucj0zH02/hV GCcPwKbc+TodcToexqN6yxxbxah6c+Y3PobLqcudlRJRr8tJ7oV2KdmSO606EHNLDIFd eOFdL22dPc4gGKmaImOk/weWWVwaURmYjQqPLP+vCX3gCDgI28kpKbtFQ+PNA51Qq4zf IpjfopkxzAsTjIeCSuvOG/g0WCWJDig77gr/Xp40ns+HDlFTTW9jjpBy8it7aoidSCg6 h+1g== X-Forwarded-Encrypted: i=1; AJvYcCWIMquf/K0lGstZIBEO2wNc1Ob9D7/7ZhyilS4xqhoJcr+NC3hXB4lSA6N7LfaIFqFLm7jyVIuBN3fbAjI=@vger.kernel.org X-Gm-Message-State: AOJu0YxmmZWoDA31B04S/vCqNyZik/1v7Jw1Sy+IZOXjQKBqzNzBYpOl tXcFmtDNNTaziEgF+G85/HMtdunWtgU7vgXs8WA7lzb0ojy6Qw9NC8TzGjLThpWB2rZG0ancogg eKgodnwAzRLg4bJiudI0fkpWfSGaY+Z3PyDbadACFdiyktKTqSUMooZSQ5i/dqE72wQ== X-Gm-Gg: ATEYQzxNN67N7iDi3YQgyuT2ibl3Ewz9E5MZmNXUQee8aGUmcWE5rznIdTNFSP5TjEn 2G3G+kueURUAEUASPG07CCnb0IL1fEJ6HXmuP1g+bUbYe6mMlOpzTfI1LxQ0ayd5/TxY0RuW2Fg TDwB2rduBxYyj9n/LXXolb9SWVwzio8sDdS2Q98twl40FIJK14CC99NK5RQVmTRpG3BRPgW/E4D YPtsZb6ArHiWDgVS4QcnunUaUtXnFk61MztA3IhsaEIkdY28u10Bb3ZsM2v1dHSx5o8TL7xXtHK FYpScBGsyOLzM0z7P+bgUaL9IGtgKYrQoO4wZia2exbUnzwevq7as8M4d3WVjedbhiUuGhGRNFX 2zZrU8M9RD6nlvBj93cweYJYH1UyoX5TBcCKtzw== X-Received: by 2002:a05:600c:1e88:b0:479:13e9:3d64 with SMTP id 5b1f17b1804b1-48526759d12mr62794545e9.15.1772826861996; Fri, 06 Mar 2026 11:54:21 -0800 (PST) X-Received: by 2002:a05:600c:1e88:b0:479:13e9:3d64 with SMTP id 5b1f17b1804b1-48526759d12mr62794165e9.15.1772826861464; Fri, 06 Mar 2026 11:54:21 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b75eesm48596485e9.14.2026.03.06.11.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:54:21 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , John Kacur , Ivan Pravdin , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 3/4] tools/rtla: Remove unneeded nr_cpus members Date: Fri, 6 Mar 2026 21:49:51 +0200 Message-ID: <20260306194953.2511960-4-costa.shul@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260306194953.2511960-1-costa.shul@redhat.com> References: <20260306194953.2511960-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nr_cpus does not change at runtime, so keeping it in struct members is unnecessary. Use the global nr_cpus instead of struct members. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 18 ++++++------ tools/tracing/rtla/src/osnoise_top.c | 3 -- tools/tracing/rtla/src/timerlat_aa.c | 10 +++---- tools/tracing/rtla/src/timerlat_hist.c | 38 ++++++++++++-------------- tools/tracing/rtla/src/timerlat_top.c | 19 ++++++------- 5 files changed, 38 insertions(+), 50 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index f39f60d3b00e..5bbec27b46a7 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -29,7 +29,6 @@ struct osnoise_hist_data { struct osnoise_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; =20 /* @@ -41,7 +40,7 @@ osnoise_free_histogram(struct osnoise_hist_data *data) int cpu; =20 /* one histogram for IRQ and one for thread, per CPU */ - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].samples) free(data->hist[cpu].samples); } @@ -73,7 +72,6 @@ static struct osnoise_hist_data =20 data->entries =3D entries; data->bucket_size =3D bucket_size; - data->nr_cpus =3D nr_cpus; =20 data->hist =3D calloc(1, sizeof(*data->hist) * nr_cpus); if (!data->hist) @@ -246,7 +244,7 @@ static void osnoise_hist_header(struct osnoise_tool *to= ol) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -275,7 +273,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -287,7 +285,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -300,7 +298,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -316,7 +314,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -351,7 +349,7 @@ osnoise_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -387,7 +385,7 @@ osnoise_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 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 3a241b69f622..672cdb254f4c 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -31,7 +31,6 @@ struct osnoise_top_cpu { =20 struct osnoise_top_data { struct osnoise_top_cpu *cpu_data; - int nr_cpus; }; =20 /* @@ -59,8 +58,6 @@ static struct osnoise_top_data *osnoise_alloc_top(void) if (!data) return NULL; =20 - data->nr_cpus =3D nr_cpus; - /* one set of histograms per CPU */ data->cpu_data =3D calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/= timerlat_aa.c index 095483375823..41d8d48c5b41 100644 --- a/tools/tracing/rtla/src/timerlat_aa.c +++ b/tools/tracing/rtla/src/timerlat_aa.c @@ -102,7 +102,6 @@ struct timerlat_aa_data { * The analysis context and system wide view */ struct timerlat_aa_context { - int nr_cpus; int dump_tasks; enum stack_format stack_format; =20 @@ -759,7 +758,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_= thresh) irq_thresh =3D irq_thresh * 1000; thread_thresh =3D thread_thresh * 1000; =20 - for (cpu =3D 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { taa_data =3D timerlat_aa_get_data(taa_ctx, cpu); =20 if (irq_thresh && taa_data->tlat_irq_latency >=3D irq_thresh) { @@ -787,7 +786,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_= thresh) =20 printf("\n"); printf("Printing CPU tasks:\n"); - for (cpu =3D 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { taa_data =3D timerlat_aa_get_data(taa_ctx, cpu); tep =3D taa_ctx->tool->trace.tep; =20 @@ -813,7 +812,7 @@ static void timerlat_aa_destroy_seqs(struct timerlat_aa= _context *taa_ctx) if (!taa_ctx->taa_data) return; =20 - for (i =3D 0; i < taa_ctx->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { taa_data =3D timerlat_aa_get_data(taa_ctx, i); =20 if (taa_data->prev_irqs_seq) { @@ -863,7 +862,7 @@ static int timerlat_aa_init_seqs(struct timerlat_aa_con= text *taa_ctx) struct timerlat_aa_data *taa_data; int i; =20 - for (i =3D 0; i < taa_ctx->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { =20 taa_data =3D timerlat_aa_get_data(taa_ctx, i); =20 @@ -1052,7 +1051,6 @@ int timerlat_aa_init(struct osnoise_tool *tool, int d= ump_tasks, enum stack_forma =20 __timerlat_aa_ctx =3D taa_ctx; =20 - taa_ctx->nr_cpus =3D nr_cpus; taa_ctx->tool =3D tool; taa_ctx->dump_tasks =3D dump_tasks; taa_ctx->stack_format =3D stack_format; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 7e735b62488c..cfb745b75b8a 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -44,7 +44,6 @@ struct timerlat_hist_data { struct timerlat_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; =20 /* @@ -56,7 +55,7 @@ timerlat_free_histogram(struct timerlat_hist_data *data) int cpu; =20 /* one histogram for IRQ and one for thread, per CPU */ - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].irq) free(data->hist[cpu].irq); =20 @@ -94,7 +93,6 @@ static struct timerlat_hist_data =20 data->entries =3D entries; data->bucket_size =3D bucket_size; - data->nr_cpus =3D nr_cpus; =20 /* one set of histograms per CPU */ data->hist =3D calloc(1, sizeof(*data->hist) * nr_cpus); @@ -204,9 +202,9 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) { struct timerlat_hist_data *data =3D tool->data; int i, j, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; =20 /* Pull histogram */ for (i =3D 0; i < data->entries; i++) { @@ -214,7 +212,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_user); if (err) return err; - for (j =3D 0; j < data->nr_cpus; j++) { + for (j =3D 0; j < nr_cpus; j++) { data->hist[j].irq[i] =3D value_irq[j]; data->hist[j].thread[i] =3D value_thread[j]; data->hist[j].user[i] =3D value_user[j]; @@ -226,7 +224,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].irq_count =3D value_irq[i]; data->hist[i].thread_count =3D value_thread[i]; data->hist[i].user_count =3D value_user[i]; @@ -236,7 +234,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].min_irq =3D value_irq[i]; data->hist[i].min_thread =3D value_thread[i]; data->hist[i].min_user =3D value_user[i]; @@ -246,7 +244,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].max_irq =3D value_irq[i]; data->hist[i].max_thread =3D value_thread[i]; data->hist[i].max_user =3D value_user[i]; @@ -256,7 +254,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].sum_irq =3D value_irq[i]; data->hist[i].sum_thread =3D value_thread[i]; data->hist[i].sum_user =3D value_user[i]; @@ -266,7 +264,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].irq[data->entries] =3D value_irq[i]; data->hist[i].thread[data->entries] =3D value_thread[i]; data->hist[i].user[data->entries] =3D value_user[i]; @@ -300,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *t= ool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -352,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -374,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -402,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -430,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -475,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params, sum.min_thread =3D ~0; sum.min_user =3D ~0; =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -622,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -660,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 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 994e89a57cd3..8fad4edb0d72 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -41,7 +41,6 @@ struct timerlat_top_cpu { =20 struct timerlat_top_data { struct timerlat_top_cpu *cpu_data; - int nr_cpus; }; =20 /* @@ -71,8 +70,6 @@ static struct timerlat_top_data *timerlat_alloc_top(void) if (!data) return NULL; =20 - data->nr_cpus =3D nr_cpus; - /* one set of histograms per CPU */ data->cpu_data =3D calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) @@ -190,16 +187,16 @@ static int timerlat_top_bpf_pull_data(struct osnoise_= tool *tool) { struct timerlat_top_data *data =3D tool->data; int i, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_CURRENT, value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].cur_irq =3D value_irq[i]; data->cpu_data[i].cur_thread =3D value_thread[i]; data->cpu_data[i].cur_user =3D value_user[i]; @@ -209,7 +206,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].irq_count =3D value_irq[i]; data->cpu_data[i].thread_count =3D value_thread[i]; data->cpu_data[i].user_count =3D value_user[i]; @@ -219,7 +216,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].min_irq =3D value_irq[i]; data->cpu_data[i].min_thread =3D value_thread[i]; data->cpu_data[i].min_user =3D value_user[i]; @@ -229,7 +226,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].max_irq =3D value_irq[i]; data->cpu_data[i].max_thread =3D value_thread[i]; data->cpu_data[i].max_user =3D value_user[i]; @@ -239,7 +236,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].sum_irq =3D value_irq[i]; data->cpu_data[i].sum_thread =3D value_thread[i]; data->cpu_data[i].sum_user =3D value_user[i]; --=20 2.53.0 From nobody Thu Apr 2 20:20:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B533C37E308 for ; Fri, 6 Mar 2026 19:54:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826871; cv=none; b=AyWxVkqtr02GCJF/3VvFPBvVrqHgH0mh4Hmh7VopCDDEAJeLJAH8gs5/F/d6Ij+d8qt6dOcVXct9y5Wexc+UhjTGGbTBNWGVQjPTvMrjDT0jIsAI89ufi5poygZTaFzrEfqfp6P+IJROwr1Ahm8pE6x74+segy5i7xctMRymWS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826871; c=relaxed/simple; bh=OWC7q8wLb6/3FihOEavLfTvY2AxxNgMODatMWWOuplM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bE/IgDTFgCMW9VYTB7OcLgLi0jTe+ZDKbA78isOwfxh65GsgoVNKKAihmoV5VF8a0Vq9jKTq1JsrjvgR9H/xSBKw04mkIDSLvuobnG4j8i351hobqlvjpc33FlY1+GTsv5jgSQdSm4o6EaZRjwYOK4cKIjs+feQfq/0x1NHZnxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OjtDvUx1; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=DSnV/CPK; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OjtDvUx1"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="DSnV/CPK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772826868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E+QhEt5URy2DIR8oMNtQgq3o4v4oSagpPMGAskLs6Ck=; b=OjtDvUx1tLNGRAR6D6/YV7VYv0GJt/Ta8PvCzMlLp+ntvUhNwtKwRluoVdRLCQfy9hFbDg n18xQbPR2H9mcV7F28e1Yu/X4HsscA/pZVsheCmTUVjo6KWweWIFe0R07lHsfamp3jTGri 5GoEW9SteXIqEmhAfmjwUeKySUgw38Y= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-417-wGONiqWAO_W6WpjEk1OD7g-1; Fri, 06 Mar 2026 14:54:27 -0500 X-MC-Unique: wGONiqWAO_W6WpjEk1OD7g-1 X-Mimecast-MFC-AGG-ID: wGONiqWAO_W6WpjEk1OD7g_1772826866 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-48529847dedso5579815e9.1 for ; Fri, 06 Mar 2026 11:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772826866; x=1773431666; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=E+QhEt5URy2DIR8oMNtQgq3o4v4oSagpPMGAskLs6Ck=; b=DSnV/CPKZ6Uyvc7laeuY1Fx1IOW8PoGAauPjGY7saOkdXowYxww0GWgXndVnJASX+A 6lo90ShnDyA620Lnc2azffH/a+cpP/4O5ylP7J71igfDAVX2QekduWrZg0zU9qgiBJJ5 zXP9xN/8XXrIBHE7eqKpUYSx0jFh/BHH5HOB6XskB8yzOf2eQkxNGNzUSQQ9ePH4AqHW mYbcQbnZBmuaV7+l0J3cvaZgYaTdKlddmlM4MQyV/IxaHM8OBkAxZPGlK2BlvJ1wOLXi Le3yeQHq16a4ZZ/vCwLeKY3mL9XqkK8erCVStiEaSH6DPuJlRGgYsdkS1DVCnXpVtG93 FTIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772826866; x=1773431666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=E+QhEt5URy2DIR8oMNtQgq3o4v4oSagpPMGAskLs6Ck=; b=kiEj9lIeYXMZDpjEgVPQ8R54TT4nV7Gw8ptv1iPlFdat6yANMd9/nfGXrThdm+3Syo iwawktltOLpwLZvy59HnacHzW6CEQC5/Lb7zrvC2RhZpph6u0631FLlP2mEmJSXkjHVX ylv9Oadrc/klgPVeOWmdZ1779hSPRzabbxHWvuwnYhFxfKBqJz7QN8GgS1gdGGBJOU+g E/ZHUtYAPuaIHKDm7c9lRZTr/fcpOCeTuIIAU8oG05sRYpY5CGRGcmoB8cbciXqOlP7J muszP345gefdeoNobncW0jr7BvknQfC1FyJxsewsKYTI4AT9AdcA2mQqf0RzikSUDO37 kNbQ== X-Forwarded-Encrypted: i=1; AJvYcCWta3B7bS2z6pIxO9A0gEZZvwsKdVnGyohJNQjknUQXFej5k2IkvWdwxxWbbX2eNTwOv0H8NN3SlM1vfpY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7cnH6lgDT948o9Kta+83l6S7RL7fDn4soecPzb/bg0u3KEuhK I7Y/+podz9w9lFIqXjpVgrCuXHAMiio9Ttuk5GEcEuJTly6h6hHpAts55qWRH9HAZ4R44ReG3lA Al5GmzIgaL5pTaqRcQ9aIeXm8MyrzsG1oL2pDdkE/ZvaXFho/RNubZxPgkcYSYyoVHA== X-Gm-Gg: ATEYQzz3TbMCDwO5jq/aBQ5KLHVNJafnkHfU3N8tawFPvyfARh+Y+zE42sSmWdB1mEQ OwlT2rXQAtiduMx9e5J51T5vi2WtLPfqyHx3Mwwi24orXM5SVy+EDYjOcSvn8RXVbO9Re/G81HI D0QSp6MdO2tJz6l0MDDvRpHL4mFuyuUfmw2f3StpxWB5P1zuFnS/s4PQchIcGUzHN1ZO9ey/+oc GVKI5AcdymJpAfabFUo4X95q0mNx4Y872h0IttPIeo7mtfO5WYlzESpjaQvHsL0NSBhNvuI66kb pqrGd85UYZ3oQV6FJCyxr4NEX+F+8uG60Mxd4W0JfzlEXlfJdcDkfba/Q1wYoRKzY+0jH/T6xIx iTVaZoAGnPFBiQuALeEwLJrYBSTzVqruo12EaQQ== X-Received: by 2002:a05:600c:4752:b0:483:7783:537b with SMTP id 5b1f17b1804b1-4852697a593mr55972965e9.24.1772826866113; Fri, 06 Mar 2026 11:54:26 -0800 (PST) X-Received: by 2002:a05:600c:4752:b0:483:7783:537b with SMTP id 5b1f17b1804b1-4852697a593mr55972745e9.24.1772826865698; Fri, 06 Mar 2026 11:54:25 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b75eesm48596485e9.14.2026.03.06.11.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:54:25 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , John Kacur , Ivan Pravdin , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 4/4] tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu Date: Fri, 6 Mar 2026 21:49:52 +0200 Message-ID: <20260306194953.2511960-5-costa.shul@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260306194953.2511960-1-costa.shul@redhat.com> References: <20260306194953.2511960-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/commo= n.h index 90a3c0d1dbf3..22ec436a93cc 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -110,7 +110,7 @@ struct common_params { =20 extern int nr_cpus; =20 -#define for_each_monitored_cpu(cpu, nr_cpus, common) \ +#define for_each_monitored_cpu(cpu, common) \ for (cpu =3D 0; cpu < nr_cpus; cpu++) \ if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus)) =20 diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 5bbec27b46a7..4181e025511a 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 *to= ol) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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:"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { - + for_each_monitored_cpu(cpu, ¶ms->common) { if (!data->hist[cpu].count) continue; =20 @@ -285,7 +284,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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 672cdb254f4c..f92caea9f2e9 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) =20 osnoise_top_header(top); =20 - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(i, ¶ms->common) { osnoise_top_print(top, i); } =20 diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 31c921efa7c1..8a44537e25cb 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; } =20 - 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 >=3D 0) close(dma_latency_fd); if (params->deepest_idle_state >=3D -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/sr= c/timerlat_hist.c index cfb745b75b8a..ee1af251c94d 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 *t= ool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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:"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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 =3D ~0; sum.min_user =3D ~0; =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 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 8fad4edb0d72..cc296c9d7fe7 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) =20 timerlat_top_header(params, top); =20 - 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); } --=20 2.53.0