diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-11-12 15:12:11 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-12-10 15:15:55 -0300 |
commit | 12115c6037aeb8aeaa792b376a63b339aee746ae (patch) | |
tree | 79f3a0294954017db3903477a5a03a5f73c3d57d /tools/perf/builtin-ftrace.c | |
parent | c95584e07b018db34a57ee067578aa1d93103511 (diff) |
perf ftrace latency: Pass ftrace pointer to histogram routines to pass more args
The ftrace->use_nsec arg is being passed to both make_historgram() and
display_histogram(), since another ftrace field will be passed to those
functions in a followup patch, make them look like other functions in
this codebase that receive the 'struct perf_ftrace' pointer.
No change in logic.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Clark Williams <williams@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20241112181214.1171244-2-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-ftrace.c')
-rw-r--r-- | tools/perf/builtin-ftrace.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 272d3c70810e..88b9f0597b92 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -726,8 +726,8 @@ out: return (done && !workload_exec_errno) ? 0 : -1; } -static void make_histogram(int buckets[], char *buf, size_t len, char *linebuf, - bool use_nsec) +static void make_histogram(struct perf_ftrace *ftrace, int buckets[], + char *buf, size_t len, char *linebuf) { char *p, *q; char *unit; @@ -774,7 +774,7 @@ static void make_histogram(int buckets[], char *buf, size_t len, char *linebuf, if (!unit || strncmp(unit, " us", 3)) goto next; - if (use_nsec) + if (ftrace->use_nsec) num *= 1000; i = log2(num); @@ -794,8 +794,9 @@ next: strcat(linebuf, p); } -static void display_histogram(int buckets[], bool use_nsec) +static void display_histogram(struct perf_ftrace *ftrace, int buckets[]) { + bool use_nsec = ftrace->use_nsec; int i; int total = 0; int bar_total = 46; /* to fit in 80 column */ @@ -951,7 +952,7 @@ static int __cmd_latency(struct perf_ftrace *ftrace) if (n < 0) break; - make_histogram(buckets, buf, n, line, ftrace->use_nsec); + make_histogram(ftrace, buckets, buf, n, line); } } @@ -968,12 +969,12 @@ static int __cmd_latency(struct perf_ftrace *ftrace) int n = read(trace_fd, buf, sizeof(buf) - 1); if (n <= 0) break; - make_histogram(buckets, buf, n, line, ftrace->use_nsec); + make_histogram(ftrace, buckets, buf, n, line); } read_func_latency(ftrace, buckets); - display_histogram(buckets, ftrace->use_nsec); + display_histogram(ftrace, buckets); out: close(trace_fd); |