Skip to contentSkip to conversation

perf tools: Fix sample type size calculation in 32 bits archs

tip:perf/urgent tip-bot for Frederic Weisbecker 1 participant 1 message May 24, 2011 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Commit-ID:  0f61f3e4db71946292ef8d6d6df74b8fcf001646
Gitweb:     http://git.kernel.org/tip/0f61f3e4db71946292ef8d6d6df74b8fcf001646
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Tue, 24 May 2011 03:31:26 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 May 2011 04:33:24 +0200

perf tools: Fix sample type size calculation in 32 bits archs

The shift used here to count the number of bits set in the mask doesn't work above the low part for archs that are not 64 bits.

Fix the constant used for the shift.

This fixes a 32-bit perf top failure reported by Eric Dumazet:

Can't parse sample, err = -14
Can't parse sample, err = -14
...

Reported-and-tested-by Eric Dumazet <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Stephane Eranian <[email protected]
---
 tools/perf/util/event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/event.c +1 -1
index 252b72a..6635fcd 100644
@@ -42,7 +42,7 @@ int perf_sample_size(u64 sample_type)
 	int i;
 
 	for (i = 0; i < 64; i++) {
-		if (mask & (1UL << i))
+		if (mask & (1ULL << i))
 			size++;
 	}