diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-17 12:24:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-17 16:09:19 -0400 |
commit | 40749d0ff49f99c3661b336fe5e5625207bd925a (patch) | |
tree | 29856d175cd23b90b67e2efaa7146ddf0f4c7612 /tools | |
parent | 8b412664d0a487c2e16ac43f4fcede346df33254 (diff) |
perf sched: Determine the number of CPUs automatically
For 'perf sched map' output, determine max_cpu automatically,
instead of the static default of 15.
[ v2: use sysconf() pointed out by Arjan van de Ven <arjan@infradead.org> ]
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-sched.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index f67e351b050b..9e04827d16be 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1347,7 +1347,7 @@ process_sched_wakeup_event(struct raw_event_sample *raw, | |||
1347 | * Track the current task - that way we can know whether there's any | 1347 | * Track the current task - that way we can know whether there's any |
1348 | * weird events, such as a task being switched away that is not current. | 1348 | * weird events, such as a task being switched away that is not current. |
1349 | */ | 1349 | */ |
1350 | static int max_cpu = 15; | 1350 | static int max_cpu; |
1351 | 1351 | ||
1352 | static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 }; | 1352 | static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 }; |
1353 | 1353 | ||
@@ -1818,6 +1818,8 @@ static struct trace_sched_handler map_ops = { | |||
1818 | 1818 | ||
1819 | static void __cmd_map(void) | 1819 | static void __cmd_map(void) |
1820 | { | 1820 | { |
1821 | max_cpu = sysconf(_SC_NPROCESSORS_CONF); | ||
1822 | |||
1821 | setup_pager(); | 1823 | setup_pager(); |
1822 | read_events(); | 1824 | read_events(); |
1823 | print_bad_events(); | 1825 | print_bad_events(); |