nr_cpus is a global variable available throughout the codebase, so passing it as a function parameter is unnecessary.
Remove the cpus parameter from timerlat_bpf_get_hist_value() and get_value(), using the global nr_cpus directly. Signed-off-by: Costa Shulyupin <[email protected]> --- tools/tracing/rtla/src/timerlat_bpf.c | 16 +++++++--------- tools/tracing/rtla/src/timerlat_bpf.h | 6 ++---- tools/tracing/rtla/src/timerlat_hist.c | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src/timerlat_bpf.c index 8d5c3a095e41..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; err = 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 = 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 = 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); } /* @@ -196,7 +194,7 @@ int timerlat_bpf_get_summary_value(enum summary_field key, return get_value(bpf->maps.summary_irq, bpf->maps.summary_thread, bpf->maps.summary_user, - key, value_irq, value_thread, value_user, nr_cpus); + key, value_irq, value_thread, value_user); } /* diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src/timerlat_bpf.h index f4a5476f2abb..531c9ef16f51 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -23,8 +23,7 @@ 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, @@ -44,8 +43,7 @@ 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; } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index db66312ec966..1c4702948532 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -209,7 +209,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) /* Pull histogram */ for (i = 0; i < data->entries; i++) { err = timerlat_bpf_get_hist_value(i, value_irq, value_thread, - value_user, nr_cpus); + value_user); if (err) return err; for (j = 0; j < nr_cpus; j++) { -- 2.52.0
