diff options
author | Namhyung Kim <namhyung@kernel.org> | 2023-03-22 19:50:05 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-04 09:39:55 -0300 |
commit | 6094c7744bb0563e833e81d8df8513f9a4e7a257 (patch) | |
tree | 687036ebe4f5dcbfe73bce3fbcbfafee431620a7 /tools/perf/util/sort.c | |
parent | 30df88a80f32ccca5c5cdcf2710d1fb2de5e314d (diff) | |
download | linux-stable-6094c7744bb0563e833e81d8df8513f9a4e7a257.tar.gz linux-stable-6094c7744bb0563e833e81d8df8513f9a4e7a257.tar.bz2 linux-stable-6094c7744bb0563e833e81d8df8513f9a4e7a257.zip |
perf hist: Improve srcfile sort key performance (really)
The earlier commit f0cdde28fecc0d7f ("perf hist: Improve srcfile sort
key performance") updated the srcfile logic but missed to change the
->cmp() callback which is called for every sample.
It should use the same logic like in the srcline to speed up the
processing because it'd return the same information repeatedly for the
same address. The real processing will be done in
sort__srcfile_collapse().
Fixes: f0cdde28fecc0d7f ("perf hist: Improve srcfile sort key performance")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230323025005.191239-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r-- | tools/perf/util/sort.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index e11e68ecf0a2..2b5cc8e4aa6e 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -657,12 +657,7 @@ static char *hist_entry__get_srcfile(struct hist_entry *e) static int64_t sort__srcfile_cmp(struct hist_entry *left, struct hist_entry *right) { - if (!left->srcfile) - left->srcfile = hist_entry__get_srcfile(left); - if (!right->srcfile) - right->srcfile = hist_entry__get_srcfile(right); - - return strcmp(right->srcfile, left->srcfile); + return sort__srcline_cmp(left, right); } static int64_t |