Skip to content

Commit

Permalink
perf hist: Improve srcfile sort key performance (really)
Browse files Browse the repository at this point in the history
The earlier commit f0cdde2 ("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: f0cdde2 ("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>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Apr 4, 2023
1 parent 30df88a commit 6094c77
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tools/perf/util/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6094c77

Please sign in to comment.