diff options
author | Paul Mackerras <paulus@samba.org> | 2010-03-10 04:36:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-11 07:36:53 -0500 |
commit | a12b51c478899fe0b7e874a559b05ba35f1128ee (patch) | |
tree | 25b9911c1932c13fd8b468aa18eb17982ba31b59 /tools/perf/Makefile | |
parent | 220b140b52ab6cc133f674a7ffec8fa792054f25 (diff) |
perf tools: Fix sparse CPU numbering related bugs
At present, the perf subcommands that do system-wide monitoring
(perf stat, perf record and perf top) don't work properly unless
the online cpus are numbered 0, 1, ..., N-1. These tools ask
for the number of online cpus with sysconf(_SC_NPROCESSORS_ONLN)
and then try to create events for cpus 0, 1, ..., N-1.
This creates problems for systems where the online cpus are
numbered sparsely. For example, a POWER6 system in
single-threaded mode (i.e. only running 1 hardware thread per
core) will have only even-numbered cpus online.
This fixes the problem by reading the /sys/devices/system/cpu/online
file to find out which cpus are online. The code that does that is in
tools/perf/util/cpumap.[ch], and consists of a read_cpu_map()
function that sets up a cpumap[] array and returns the number of
online cpus. If /sys/devices/system/cpu/online can't be read or
can't be parsed successfully, it falls back to using sysconf to
ask how many cpus are online and sets up an identity map in cpumap[].
The perf record, perf stat and perf top code then calls
read_cpu_map() in the system-wide monitoring case (instead of
sysconf) and uses cpumap[] to get the cpu numbers to pass to
perf_event_open.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
LKML-Reference: <20100310093609.GA3959@brick.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 2d537382c686..5840499e2d22 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -387,6 +387,7 @@ LIB_H += util/thread.h | |||
387 | LIB_H += util/trace-event.h | 387 | LIB_H += util/trace-event.h |
388 | LIB_H += util/probe-finder.h | 388 | LIB_H += util/probe-finder.h |
389 | LIB_H += util/probe-event.h | 389 | LIB_H += util/probe-event.h |
390 | LIB_H += util/cpumap.h | ||
390 | 391 | ||
391 | LIB_OBJS += util/abspath.o | 392 | LIB_OBJS += util/abspath.o |
392 | LIB_OBJS += util/alias.o | 393 | LIB_OBJS += util/alias.o |
@@ -433,6 +434,7 @@ LIB_OBJS += util/sort.o | |||
433 | LIB_OBJS += util/hist.o | 434 | LIB_OBJS += util/hist.o |
434 | LIB_OBJS += util/probe-event.o | 435 | LIB_OBJS += util/probe-event.o |
435 | LIB_OBJS += util/util.o | 436 | LIB_OBJS += util/util.o |
437 | LIB_OBJS += util/cpumap.o | ||
436 | 438 | ||
437 | BUILTIN_OBJS += builtin-annotate.o | 439 | BUILTIN_OBJS += builtin-annotate.o |
438 | 440 | ||