perf sched: Determine the number of CPUs automatically
Commit-ID: 5349256ab12dcbc766495cd1cf3651f7203f8564 Gitweb: http://git.kernel.org/tip/5349256ab12dcbc766495cd1cf3651f7203f8564 Author: Ingo Molnar <[email protected]> AuthorDate: Thu, 17 Sep 2009 18:24:55 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 17 Sep 2009 18:24:55 +0200
perf sched: Determine the number of CPUs automatically
For 'perf sched map' output, determine max_cpu automatically, instead of the static default of 15.
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>
--- tools/perf/builtin-sched.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
tools/perf/builtin-sched.c +4 -1
@@ -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 };
@@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops = {static void __cmd_map (void ) { + max_cpu =system ("exit `grep ^processor /proc/cpuinfo | wc -l`" ); + max_cpu =WEXITSTATUS (max_cpu)-1 ; +setup_pager ();read_events ();print_bad_events ();
On Thu, 17 Sep 2009 18:07:09 GMT
Quoted 9 lines
perf sched: Determine the number of CPUs automatically
For 'perf sched map' output, determine
max_cpuautomatically, instead of the static default of 15.static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
tools/perf/builtin-sched.c static struct trace_sched_handler map_ops = { · line 1821
Quoted 5 lines
tools/perf/builtin-sched.c +1
-1@@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops = {static void __cmd_map (void ) { + max_cpu = system("exit `grep ^processor /proc/cpuinfo | wc -l`");
YUCK.
what is wrong with
max_cpu = sysconf(_SC_NPROCESSORS_CONF);
??
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 18 lines · Arjan van de Ven
On Thu, 17 Sep 2009 18:07:09 GMT
Quoted 9 lines
perf sched: Determine the number of CPUs automatically
For 'perf sched map' output, determine
max_cpuautomatically, instead of the static default of 15.static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
tools/perf/builtin-sched.c static struct trace_sched_handler map_ops = { · line 1821
Quoted 5 lines
tools/perf/builtin-sched.c +1
-1@@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops = {static void __cmd_map (void ) { + max_cpu = system("exit `grep ^processor /proc/cpuinfo | wc -l`");YUCK.
Quoted 3 lines
what is wrong with
max_cpu=sysconf(_SC_NPROCESSORS_CONF);
??
That's nicer - mind sending a patch?
Ingo
Quoted 21 lines · Ingo Molnar
Quoted 18 lines · Arjan van de Ven
On Thu, 17 Sep 2009 18:07:09 GMT
Quoted 9 lines
perf sched: Determine the number of CPUs automatically
For 'perf sched map' output, determine
max_cpuautomatically, instead of the static default of 15.static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
tools/perf/builtin-sched.c static struct trace_sched_handler map_ops = { · line 1821
Quoted 5 lines
tools/perf/builtin-sched.c +1
-1@@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops = {static void __cmd_map (void ) { + max_cpu = system("exit `grep ^processor /proc/cpuinfo | wc -l`");YUCK.
Quoted 5 lines
Quoted 3 lines
what is wrong with
max_cpu=sysconf(_SC_NPROCESSORS_CONF);
??That's nicer - mind sending a patch?
fixed this up myself.
Ingo