Skip to contentSkip to conversation

perf, tools: Fix sorting for 64bit entries

PATCH Applied Andi Kleen 3 participants 3 messages Sep 27, 2013 – Oct 1, 2013 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf, tools: Fix sorting for 64bit entries

From: Andi Kleen <[email protected]>

Some of the node comparisons in hist.c dropped the upper 32bit by using an int variable to store the compare result. This broke various 64bit fields, causing incorrect collapsing (found for the TSX transaction field)

Just use int64_t always.

---
 tools/perf/util/hist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/hist.c +2 -2
index 4714a72..4832b59 100644
@@ -350,7 +350,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
 	struct rb_node **p;
 	struct rb_node *parent = NULL;
 	struct hist_entry *he;
-	int cmp;
+	int64_t cmp;
 
 	p = &hists->entries_in->rb_node;
 
@@ -887,7 +887,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
 	struct rb_node **p;
 	struct rb_node *parent = NULL;
 	struct hist_entry *he;
-	int cmp;
+	int64_t cmp;
 
 	if (sort__need_collapse)
 		root = &hists->entries_collapsed;
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Andi,

Quoted 8 lines · Andi Kleen

From: Andi Kleen <[email protected]>

Some of the node comparisons in hist.c dropped the upper 32bit by using an int variable to store the compare result. This broke various 64bit fields, causing incorrect collapsing (found for the TSX transaction field)

Just use int64_t always.

Thanks,
Namhyung

#2 lore raw
In reply to Andi Kleen

Em Fri, Sep 27, 2013 at 04:39:24PM -0700, Andi Kleen escreveu:

Quoted 8 lines

From: Andi Kleen <[email protected]>

Some of the node comparisons in hist.c dropped the upper 32bit by using an int variable to store the compare result. This broke various 64bit fields, causing incorrect collapsing (found for the TSX transaction field)

Just use int64_t always.

Thanks, applied.