Skip to contentSkip to conversation

perf top: Set target.system_wide

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 11, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  10b47d54154ce711e4c4438aff10f0215b2ab8eb
Gitweb:     http://git.kernel.org/tip/10b47d54154ce711e4c4438aff10f0215b2ab8eb
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 7 May 2012 16:33:56 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 May 2012 16:46:03 -0300

perf top: Set target.system_wide

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.

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]>
---
 tools/perf/builtin-top.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +4 -0
index 2a0ec09..e40f86e 100644
@@ -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);