Skip to content

Commit 12115c6

Browse files
committed
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 <[email protected]> Cc: Clark Williams <[email protected]> Cc: Gabriele Monaco <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c95584e commit 12115c6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tools/perf/builtin-ftrace.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace)
726726
return (done && !workload_exec_errno) ? 0 : -1;
727727
}
728728

729-
static void make_histogram(int buckets[], char *buf, size_t len, char *linebuf,
730-
bool use_nsec)
729+
static void make_histogram(struct perf_ftrace *ftrace, int buckets[],
730+
char *buf, size_t len, char *linebuf)
731731
{
732732
char *p, *q;
733733
char *unit;
@@ -774,7 +774,7 @@ static void make_histogram(int buckets[], char *buf, size_t len, char *linebuf,
774774
if (!unit || strncmp(unit, " us", 3))
775775
goto next;
776776

777-
if (use_nsec)
777+
if (ftrace->use_nsec)
778778
num *= 1000;
779779

780780
i = log2(num);
@@ -794,8 +794,9 @@ static void make_histogram(int buckets[], char *buf, size_t len, char *linebuf,
794794
strcat(linebuf, p);
795795
}
796796

797-
static void display_histogram(int buckets[], bool use_nsec)
797+
static void display_histogram(struct perf_ftrace *ftrace, int buckets[])
798798
{
799+
bool use_nsec = ftrace->use_nsec;
799800
int i;
800801
int total = 0;
801802
int bar_total = 46; /* to fit in 80 column */
@@ -951,7 +952,7 @@ static int __cmd_latency(struct perf_ftrace *ftrace)
951952
if (n < 0)
952953
break;
953954

954-
make_histogram(buckets, buf, n, line, ftrace->use_nsec);
955+
make_histogram(ftrace, buckets, buf, n, line);
955956
}
956957
}
957958

@@ -968,12 +969,12 @@ static int __cmd_latency(struct perf_ftrace *ftrace)
968969
int n = read(trace_fd, buf, sizeof(buf) - 1);
969970
if (n <= 0)
970971
break;
971-
make_histogram(buckets, buf, n, line, ftrace->use_nsec);
972+
make_histogram(ftrace, buckets, buf, n, line);
972973
}
973974

974975
read_func_latency(ftrace, buckets);
975976

976-
display_histogram(buckets, ftrace->use_nsec);
977+
display_histogram(ftrace, buckets);
977978

978979
out:
979980
close(trace_fd);

0 commit comments

Comments
 (0)