Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588563

Re: [PATCH] perf tools: Force uncore events to system wide monitoring

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] perf tools: Force uncore events to system wide monitoring
Date 2017-02-27 10:40 +0100
Message-ID <tfpWF-3Dy-11@gated-at.bofh.it> (permalink)
References <tel8J-79A-11@gated-at.bofh.it> <teogi-MF-15@gated-at.bofh.it> <teoJk-1cU-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Feb 24, 2017 at 03:00:03PM +0100, Jiri Olsa wrote:
> On Fri, Feb 24, 2017 at 10:32:22AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Feb 24, 2017 at 11:17:14AM +0100, Jiri Olsa escreveu:
> > > Adding system_wide flag to uncore pmu objects and passing
> > > this flag along to the their events.
> > 
> > Boris, ack? Tested-by?
> 
> actualy we discussed that on irc and I need to send new version ;-)

Boris,
would you mind testing new version?

thanks,
jirka


---
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index f4f555a67e9b..1320352cda04 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2350,6 +2350,34 @@ static int __cmd_report(int argc, const char **argv)
 	return 0;
 }
 
+static void setup_system_wide(int forks)
+{
+	/*
+	 * Make system wide (-a) the default target if
+	 * no target was specified and one of following
+	 * conditions is met:
+	 *
+	 *   - there's no workload specified
+	 *   - there is workload specified but all requested
+	 *     events are system wide events
+	 */
+	if (!target__none(&target))
+		return;
+
+	if (!forks)
+		target.system_wide = true;
+	else {
+		struct perf_evsel *counter;
+
+		evlist__for_each_entry(evsel_list, counter) {
+			if (!counter->system_wide)
+				return;
+		}
+
+		target.system_wide = true;
+	}
+}
+
 int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	const char * const stat_usage[] = {
@@ -2456,9 +2484,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 	} else if (big_num_opt == 0) /* User passed --no-big-num */
 		big_num = false;
 
-	/* Make system wide (-a) the default target. */
-	if (!argc && target__none(&target))
-		target.system_wide = true;
+	setup_system_wide(argc);
 
 	if (run_count < 0) {
 		pr_err("Run count must be a positive number\n");
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 67a8aebc67ab..54355d3caf09 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -316,8 +316,9 @@ __add_event(struct list_head *list, int *idx,
 		return NULL;
 
 	(*idx)++;
-	evsel->cpus     = cpu_map__get(cpus);
-	evsel->own_cpus = cpu_map__get(cpus);
+	evsel->cpus        = cpu_map__get(cpus);
+	evsel->own_cpus    = cpu_map__get(cpus);
+	evsel->system_wide = !!cpus;
 
 	if (name)
 		evsel->name = strdup(name);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf tools: Force uncore events to system wide monitoring Jiri Olsa <jolsa@kernel.org> - 2017-02-24 11:20 +0100
  Re: [PATCH] perf tools: Force uncore events to system wide monitoring Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-24 14:40 +0100
    Re: [PATCH] perf tools: Force uncore events to system wide monitoring Jiri Olsa <jolsa@redhat.com> - 2017-02-24 15:10 +0100
      Re: [PATCH] perf tools: Force uncore events to system wide monitoring Jiri Olsa <jolsa@redhat.com> - 2017-02-27 10:40 +0100
        Re: [PATCH] perf tools: Force uncore events to system wide monitoring Borislav Petkov <bp@alien8.de> - 2017-02-27 12:50 +0100

csiph-web