Commit 3cb6d1540880e767d911b79eb49578de2190f428

Authored by Frederic Weisbecker
Committed by Ingo Molnar
1 parent 998bedc8c5

perf tools: Fix sample size bit operations

What we want is to count the number of bits in the mask,
not some other random operation written in the middle
of the night.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1306148788-6179-2-git-send-email-fweisbec@gmail.com
[ Fixed perf_event__names[] alignment which was nearby and hurting my eyes ... ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 1 changed file with 16 additions and 16 deletions Side-by-side Diff

tools/perf/util/event.c
... ... @@ -9,21 +9,21 @@
9 9 #include "thread_map.h"
10 10  
11 11 static const char *perf_event__names[] = {
12   - [0] = "TOTAL",
13   - [PERF_RECORD_MMAP] = "MMAP",
14   - [PERF_RECORD_LOST] = "LOST",
15   - [PERF_RECORD_COMM] = "COMM",
16   - [PERF_RECORD_EXIT] = "EXIT",
17   - [PERF_RECORD_THROTTLE] = "THROTTLE",
18   - [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
19   - [PERF_RECORD_FORK] = "FORK",
20   - [PERF_RECORD_READ] = "READ",
21   - [PERF_RECORD_SAMPLE] = "SAMPLE",
22   - [PERF_RECORD_HEADER_ATTR] = "ATTR",
23   - [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
24   - [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
25   - [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID",
26   - [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND",
  12 + [0] = "TOTAL",
  13 + [PERF_RECORD_MMAP] = "MMAP",
  14 + [PERF_RECORD_LOST] = "LOST",
  15 + [PERF_RECORD_COMM] = "COMM",
  16 + [PERF_RECORD_EXIT] = "EXIT",
  17 + [PERF_RECORD_THROTTLE] = "THROTTLE",
  18 + [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
  19 + [PERF_RECORD_FORK] = "FORK",
  20 + [PERF_RECORD_READ] = "READ",
  21 + [PERF_RECORD_SAMPLE] = "SAMPLE",
  22 + [PERF_RECORD_HEADER_ATTR] = "ATTR",
  23 + [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
  24 + [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
  25 + [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID",
  26 + [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND",
27 27 };
28 28  
29 29 const char *perf_event__name(unsigned int id)
... ... @@ -42,7 +42,7 @@
42 42 int i;
43 43  
44 44 for (i = 0; i < 64; i++) {
45   - if ((mask << i) & 1)
  45 + if (mask & (1UL << i))
46 46 size++;
47 47 }
48 48