Skip to contentSkip to conversation

perf tools: Fix time sorting

PATCH Applied Jiri Olsa 5 participants 6 messages Nov 4, 2019 – Nov 6, 2019

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf tools: Fix time sorting

The final sort might get confused when the comparison is done over bigger numbers than int like for -s time.

Check following report for longer workloads:

  $ perf report -s time -F time,overhead --stdio

Fixing hist_entry__sort to properly return int64_t and not possible cut int.

---
 tools/perf/util/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.c +1 -1
index 679a1d75090c..7b6eaf5e0bda 100644
@@ -1625,7 +1625,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;
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jiri Olsa

The final sort might get confused when the comparison is done over bigger numbers than int like for -s time.

Check following report for longer workloads:

Quoted 8 lines
  $ perf report -s time -F time,overhead --stdio

Fixing hist_entry__sort to properly return int64_t and not possible cut int.

Looks good.

-Andi

#2 lore raw

Em Mon, Nov 04, 2019 at 04:48:54PM -0800, Andi Kleen escreveu:

Quoted 10 lines · Jiri Olsa
Quoted 9 lines

The final sort might get confused when the comparison is done over bigger numbers than int like for -s time.

Check following report for longer workloads:

  $ perf report -s time -F time,overhead --stdio

Fixing hist_entry__sort to properly return int64_t and not possible cut int.

Quoted 7 lines
Quoted 3 lines

Looks good.

Thanks, applied after adding:

Fixes 043ca389a318 ("perf tools: Use hpp formats to sort final output")
Cc [email protected] # v3.16+

- Arnaldo

#3 lore raw
Quoted 15 lines · Arnaldo Carvalho de Melo

Em Mon, Nov 04, 2019 at 04:48:54PM -0800, Andi Kleen escreveu:

Quoted 14 lines · Jiri Olsa
Quoted 12 lines

The final sort might get confused when the comparison is done over bigger numbers than int like for -s time.

Check following report for longer workloads:

  $ perf report -s time -F time,overhead --stdio

Fixing hist_entry__sort to properly return int64_t and not possible cut int.

Quoted 8 lines
Quoted 3 lines

Looks good.

Thanks, applied after adding:

Fixes 043ca389a318 ("perf tools: Use hpp formats to sort final output")
Cc [email protected] # v3.16+

I was wondering about putting some commit there,
because it was there for long time.. but that
commit you use seems to be old enough.. ;-)

thanks,
jirka

#4 lore raw

Em Tue, Nov 05, 2019 at 01:41:50PM +0100, Jiri Olsa escreveu:

Quoted 20 lines · Arnaldo Carvalho de Melo
Quoted 19 lines

Em Mon, Nov 04, 2019 at 04:48:54PM -0800, Andi Kleen escreveu:

Quoted 17 lines · Jiri Olsa
Quoted 4 lines

The final sort might get confused when the comparison is done over bigger numbers than int like for -s time.

Check following report for longer workloads:

Quoted 8 lines
  $ perf report -s time -F time,overhead --stdio

Fixing hist_entry__sort to properly return int64_t and not possible cut int.

Looks good.

Quoted 8 lines
Quoted 4 lines

Thanks, applied after adding:

Fixes 043ca389a318 ("perf tools: Use hpp formats to sort final output")
Cc [email protected] # v3.16+

I was wondering about putting some commit there,
because it was there for long time.. but that
commit you use seems to be old enough.. ;-)

Yeah, I think it predates that, but the one I picked should have fixed that problem, as it was touching these routines, so I thought would be a good one to stick in a fixes tag :-)

- Arnaldo

Quoted 2 lines

thanks,
jirka

Signature · 1 line
- Arnaldo
merge bot Applied
#5 lore raw
In reply to Jiri Olsa
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     722ddfde366fd46205456a9c5ff9b3359dc9a75e
Gitweb:        https://git.kernel.org/tip/722ddfde366fd46205456a9c5ff9b3359dc9a75e
Author:        Jiri Olsa <[email protected]>
AuthorDate:    Tue, 05 Nov 2019 00:27:11 +01:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 05 Nov 2019 08:49:14 -03:00

perf tools: Fix time sorting

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")
Cc Alexander Shishkin <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc [email protected] # v3.16+
---
 tools/perf/util/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.c +1 -1
index 679a1d7..7b6eaf5 100644
@@ -1625,7 +1625,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;