perf top: Set target.system_wide
authorArnaldo Carvalho de Melo <[email protected]>
Mon, 7 May 2012 19:33:56 +0000 (16:33 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Mon, 7 May 2012 19:46:03 +0000 (16:46 -0300)
Check if neither of --pid, --tid or --uid was specified and if so, set
system_wide appropriately.

Namhyung's patch would make using any of the above target specifiers
emit a warning in perf_target__validate, since it would see
target.system_wide set and one of the others as well.

So set system_wide after validation.

Suggested-by: David Ahern <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-top.c

index 2a0ec09b9b77fe527bb63922af1b24d4e48538c1..e40f86ea364147e114b47428953b888177c9abab 100644 (file)
@@ -1258,6 +1258,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
        if (top.target.uid_str != NULL && top.target.uid == UINT_MAX - 1)
                goto out_delete_evlist;
 
+       if (top.target.tid == 0 && top.target.pid == 0 &&
+           top.target.uid_str == NULL)
+               top.target.system_wide = true;
+
        if (perf_evlist__create_maps(top.evlist, &top.target) < 0)
                usage_with_options(top_usage, options);