Skip to content

Commit

Permalink
perf record: Fix the profiling of existing pid or whole box
Browse files Browse the repository at this point in the history
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 <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed May 27, 2009
1 parent a930d2c commit ef65b2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Documentation/perf_counter/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ef65b2a

Please sign in to comment.