Commit 40749d0f authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent 8b412664
...@@ -1347,7 +1347,7 @@ process_sched_wakeup_event(struct raw_event_sample *raw, ...@@ -1347,7 +1347,7 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
* Track the current task - that way we can know whether there's any * Track the current task - that way we can know whether there's any
* weird events, such as a task being switched away that is not current. * weird events, such as a task being switched away that is not current.
*/ */
static int max_cpu = 15; static int max_cpu;
static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 }; static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
...@@ -1818,6 +1818,8 @@ static struct trace_sched_handler map_ops = { ...@@ -1818,6 +1818,8 @@ static struct trace_sched_handler map_ops = {
static void __cmd_map(void) static void __cmd_map(void)
{ {
max_cpu = sysconf(_SC_NPROCESSORS_CONF);
setup_pager(); setup_pager();
read_events(); read_events();
print_bad_events(); print_bad_events();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment