]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/rtla: Consolidate nr_cpus usage across all tools
authorCosta Shulyupin <costa.shul@redhat.com>
Fri, 6 Mar 2026 19:49:49 +0000 (21:49 +0200)
committerTomas Glozar <tglozar@redhat.com>
Mon, 9 Mar 2026 07:49:16 +0000 (08:49 +0100)
commit115b06a008756ec777249dc9f432dc1a6c681396
tree6384fa33c1b8cf419a0a4d345c58ea321d4afad0
parente4be7e96d076b014abb77fc7fe72c92e8788f3df
tools/rtla: Consolidate nr_cpus usage across all tools

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 <costa.shul@redhat.com>
Link: https://lore.kernel.org/r/20260306194953.2511960-2-costa.shul@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
12 files changed:
tools/tracing/rtla/src/common.c
tools/tracing/rtla/src/common.h
tools/tracing/rtla/src/osnoise_hist.c
tools/tracing/rtla/src/osnoise_top.c
tools/tracing/rtla/src/timerlat.c
tools/tracing/rtla/src/timerlat_aa.c
tools/tracing/rtla/src/timerlat_hist.c
tools/tracing/rtla/src/timerlat_top.c
tools/tracing/rtla/src/timerlat_u.c
tools/tracing/rtla/src/timerlat_u.h
tools/tracing/rtla/src/utils.c
tools/tracing/rtla/tests/unit/unit_tests.c