perf record: Fix the profiling of existing pid or whole box
Commit-ID: ef65b2a0b3a2f82850144df6e6a7796f6d66da6b Gitweb: http://git.kernel.org/tip/ef65b2a0b3a2f82850144df6e6a7796f6d66da6b Author: Mike Galbraith <[email protected]> AuthorDate: Wed, 27 May 2009 10:10:51 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 27 May 2009 12:31:03 +0200
perf record: Fix the profiling of existing pid or whole box
Perf record bails if no command argument is provided, so you can't use naked -a or -p to profile a running task or the whole box.
Allow foreground profiling of an existing pid or the entire system.
[ Impact: fix command option handling bug ]
Signed-off-by Mike Galbraith <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc John Kacur <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- Documentation/perf_counter/builtin-record.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/perf_counter/builtin-record.c +2 -2
@@ -354,7 +354,7 @@ static int __cmd_record(int argc, const char **argv)signal (SIGCHLD , sig_handler);signal (SIGINT , sig_handler); -if (target_pid ==-1 ) { +if (target_pid ==-1 && argc) { pid =fork ();if (pid <0 )perror ("failed to fork" );
@@ -430,7 +430,7 @@ int cmd_record(int argc, const char **argv, const char *prefix)create_events_help (events_help_msg); argc =parse_options (argc, argv, options, record_usage,0 ); -if (!argc) +if (!argc && target_pid ==-1 && !system_wide)usage_with_options (record_usage, options);if (!nr_counters) {