From: Jiri Olsa Date: Mon, 4 Nov 2019 23:27:11 +0000 (+0100) Subject: perf tools: Fix time sorting X-Git-Tag: Ubuntu-5.3.0-25.27~340 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=138b8f2d8a37de805f8fc8039e0a685ff15faf54;p=mirror_ubuntu-eoan-kernel.git perf tools: Fix time sorting BugLink: https://bugs.launchpad.net/bugs/1852338 commit 722ddfde366fd46205456a9c5ff9b3359dc9a75e upstream. The final sort might get confused when the comparison is done over bigger numbers than int like for -s time. Check the following report for longer workloads: $ perf report -s time -F time,overhead --stdio Fix hist_entry__sort() to properly return int64_t and not possible cut int. Fixes: 043ca389a318 ("perf tools: Use hpp formats to sort final output") Signed-off-by: Jiri Olsa Reviewed-by: Andi Kleen Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Cc: stable@vger.kernel.org # v3.16+ Link: http://lore.kernel.org/lkml/20191104232711.16055-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Signed-off-by: Connor Kuehl Signed-off-by: Stefan Bader --- diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 6bd270a1e93e..7ec174361c54 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1618,7 +1618,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog) return 0; } -static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b) +static int64_t hist_entry__sort(struct hist_entry *a, struct hist_entry *b) { struct hists *hists = a->hists; struct perf_hpp_fmt *fmt;