Skip to content

Commit

Permalink
perf sched: Determine the number of CPUs automatically
Browse files Browse the repository at this point in the history
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 <[email protected]> ]

Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ingo Molnar committed Sep 17, 2009
1 parent 8b41266 commit 40749d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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 };

Expand Down Expand Up @@ -1818,6 +1818,8 @@ static struct trace_sched_handler map_ops = {

static void __cmd_map(void)
{
max_cpu = sysconf(_SC_NPROCESSORS_CONF);

setup_pager();
read_events();
print_bad_events();
Expand Down

0 comments on commit 40749d0

Please sign in to comment.