linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Michael Petlan <mpetlan@redhat.com>
Subject: [PATCH 19/73] libperf: Move system_wide from struct evsel to struct perf_evsel
Date: Fri, 13 Sep 2019 15:23:01 +0200	[thread overview]
Message-ID: <20190913132355.21634-20-jolsa@kernel.org> (raw)
In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org>

Move the system_wide member from perf's evsel to libperf's perf_evsel.

Link: http://lkml.kernel.org/n/tip-it7hq5v16y44z220vas1kf8p@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/arch/x86/util/intel-pt.c     |  4 ++--
 tools/perf/builtin-script.c             |  2 +-
 tools/perf/builtin-stat.c               |  4 ++--
 tools/perf/lib/include/internal/evsel.h |  1 +
 tools/perf/tests/switch-tracking.c      |  6 +++---
 tools/perf/util/evlist.c                | 10 +++++-----
 tools/perf/util/evsel.c                 |  8 ++++----
 tools/perf/util/evsel.h                 |  1 -
 tools/perf/util/parse-events.c          |  2 +-
 tools/perf/util/stat.c                  |  2 +-
 10 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index c0a7535cfd0e..1ae050c4045b 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -421,7 +421,7 @@ static int intel_pt_track_switches(struct evlist *evlist)
 	perf_evsel__set_sample_bit(evsel, CPU);
 	perf_evsel__set_sample_bit(evsel, TIME);
 
-	evsel->system_wide = true;
+	evsel->core.system_wide = true;
 	evsel->no_aux_samples = true;
 	evsel->immediate = true;
 
@@ -722,7 +722,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
 				switch_evsel->core.attr.sample_period = 1;
 				switch_evsel->core.attr.context_switch = 1;
 
-				switch_evsel->system_wide = true;
+				switch_evsel->core.system_wide = true;
 				switch_evsel->no_aux_samples = true;
 				switch_evsel->immediate = true;
 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index e079b34201f2..c602793d5483 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1915,7 +1915,7 @@ static void __process_stat(struct evsel *counter, u64 tstamp)
 	int cpu, thread;
 	static int header_printed;
 
-	if (counter->system_wide)
+	if (counter->core.system_wide)
 		nthreads = 1;
 
 	if (!header_printed) {
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 7e17bf9f700a..35897048ba53 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -276,7 +276,7 @@ static int read_counter(struct evsel *counter, struct timespec *rs)
 	if (!counter->supported)
 		return -ENOENT;
 
-	if (counter->system_wide)
+	if (counter->core.system_wide)
 		nthreads = 1;
 
 	for (thread = 0; thread < nthreads; thread++) {
@@ -1681,7 +1681,7 @@ static void setup_system_wide(int forks)
 		struct evsel *counter;
 
 		evlist__for_each_entry(evsel_list, counter) {
-			if (!counter->system_wide)
+			if (!counter->core.system_wide)
 				return;
 		}
 
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h
index 8b854d1c9b45..220cb2e2b54e 100644
--- a/tools/perf/lib/include/internal/evsel.h
+++ b/tools/perf/lib/include/internal/evsel.h
@@ -18,6 +18,7 @@ struct perf_evsel {
 
 	/* parse modifier helper */
 	int			 nr_members;
+	bool			 system_wide;
 };
 
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index f6c2c026988a..01bfb087ce22 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -144,7 +144,7 @@ static int process_sample_event(struct evlist *evlist,
 			return err;
 		/*
 		 * Check for no missing sched_switch events i.e. that the
-		 * evsel->system_wide flag has worked.
+		 * evsel->core.system_wide flag has worked.
 		 */
 		if (switch_tracking->tids[cpu] != -1 &&
 		    switch_tracking->tids[cpu] != prev_tid) {
@@ -316,7 +316,7 @@ static int process_events(struct evlist *evlist,
  *
  * This function implements a test that checks that sched_switch events and
  * tracking events can be recorded for a workload (current process) using the
- * evsel->system_wide and evsel->tracking flags (respectively) with other events
+ * evsel->core.system_wide and evsel->tracking flags (respectively) with other events
  * sometimes enabled or disabled.
  */
 int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused)
@@ -396,7 +396,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_
 	perf_evsel__set_sample_bit(switch_evsel, CPU);
 	perf_evsel__set_sample_bit(switch_evsel, TIME);
 
-	switch_evsel->system_wide = true;
+	switch_evsel->core.system_wide = true;
 	switch_evsel->no_aux_samples = true;
 	switch_evsel->immediate = true;
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 98827df5a40a..0ffa1e9b6243 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -318,7 +318,7 @@ int perf_evlist__add_newtp(struct evlist *evlist,
 static int perf_evlist__nr_threads(struct evlist *evlist,
 				   struct evsel *evsel)
 {
-	if (evsel->system_wide)
+	if (evsel->core.system_wide)
 		return 1;
 	else
 		return perf_thread_map__nr(evlist->core.threads);
@@ -409,7 +409,7 @@ int perf_evlist__alloc_pollfd(struct evlist *evlist)
 	struct evsel *evsel;
 
 	evlist__for_each_entry(evlist, evsel) {
-		if (evsel->system_wide)
+		if (evsel->core.system_wide)
 			nfds += nr_cpus;
 		else
 			nfds += nr_cpus * nr_threads;
@@ -535,7 +535,7 @@ static void perf_evlist__set_sid_idx(struct evlist *evlist,
 		sid->cpu = evlist->core.cpus->map[cpu];
 	else
 		sid->cpu = -1;
-	if (!evsel->system_wide && evlist->core.threads && thread >= 0)
+	if (!evsel->core.system_wide && evlist->core.threads && thread >= 0)
 		sid->tid = perf_thread_map__pid(evlist->core.threads, thread);
 	else
 		sid->tid = -1;
@@ -762,7 +762,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
 			mp->prot &= ~PROT_WRITE;
 		}
 
-		if (evsel->system_wide && thread)
+		if (evsel->core.system_wide && thread)
 			continue;
 
 		cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu);
@@ -792,7 +792,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
 		 * other events, so it should not need to be polled anyway.
 		 * Therefore don't add it for polling.
 		 */
-		if (!evsel->system_wide &&
+		if (!evsel->core.system_wide &&
 		    __perf_evlist__add_pollfd(evlist, fd, &maps[idx], revent) < 0) {
 			perf_mmap__put(&maps[idx]);
 			return -1;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 85825384f9e8..9dcee5a8875e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1231,7 +1231,7 @@ int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads)
 	if (ncpus == 0 || nthreads == 0)
 		return 0;
 
-	if (evsel->system_wide)
+	if (evsel->core.system_wide)
 		nthreads = 1;
 
 	evsel->sample_id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id));
@@ -1662,7 +1662,7 @@ static bool ignore_missing_thread(struct evsel *evsel,
 		return false;
 
 	/* The system wide setup does not work with threads. */
-	if (evsel->system_wide)
+	if (evsel->core.system_wide)
 		return false;
 
 	/* The -ESRCH is perf event syscall errno for pid's not found. */
@@ -1771,7 +1771,7 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 		threads = empty_thread_map;
 	}
 
-	if (evsel->system_wide)
+	if (evsel->core.system_wide)
 		nthreads = 1;
 	else
 		nthreads = threads->nr;
@@ -1818,7 +1818,7 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 		for (thread = 0; thread < nthreads; thread++) {
 			int fd, group_fd;
 
-			if (!evsel->cgrp && !evsel->system_wide)
+			if (!evsel->cgrp && !evsel->core.system_wide)
 				pid = perf_thread_map__pid(threads, thread);
 
 			group_fd = get_group_fd(evsel, cpu, thread);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 68321d10eb2d..eb4d03cd0b17 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -146,7 +146,6 @@ struct evsel {
 	bool 			disabled;
 	bool			no_aux_samples;
 	bool			immediate;
-	bool			system_wide;
 	bool			tracking;
 	bool			per_pkg;
 	bool			precise_max;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5ec21d21113c..403fb5e05108 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -335,7 +335,7 @@ __add_event(struct list_head *list, int *idx,
 	(*idx)++;
 	evsel->core.cpus   = perf_cpu_map__get(cpus);
 	evsel->core.own_cpus = perf_cpu_map__get(cpus);
-	evsel->system_wide = pmu ? pmu->is_uncore : false;
+	evsel->core.system_wide = pmu ? pmu->is_uncore : false;
 	evsel->auto_merge_stats = auto_merge_stats;
 
 	if (name)
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 8f1ea27f976f..ef02d8b709ff 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -318,7 +318,7 @@ static int process_counter_maps(struct perf_stat_config *config,
 	int ncpus = perf_evsel__nr_cpus(counter);
 	int cpu, thread;
 
-	if (counter->system_wide)
+	if (counter->core.system_wide)
 		nthreads = 1;
 
 	for (thread = 0; thread < nthreads; thread++) {
-- 
2.21.0


  parent reply	other threads:[~2019-09-13 13:28 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 13:22 [RFC 00/73] libperf: Add sampling interface Jiri Olsa
2019-09-13 13:22 ` [PATCH 01/73] tools: Add missing stdio.h include to asm/bug.h header Jiri Olsa
2019-09-13 13:22 ` [PATCH 02/73] perf tests: Fix static build test Jiri Olsa
2019-09-13 13:22 ` [PATCH 03/73] perf tools: Rename struct perf_mmap to struct mmap Jiri Olsa
2019-09-13 13:22 ` [PATCH 04/73] perf tools: Rename perf_evlist__mmap() to evlist__mmap() Jiri Olsa
2019-09-13 13:22 ` [PATCH 05/73] perf tools: Rename perf_evlist__munmap() to evlist__munmap() Jiri Olsa
2019-09-13 13:22 ` [PATCH 06/73] perf tools: Rename perf_evlist__alloc_mmap() to evlist__alloc_mmap() Jiri Olsa
2019-09-13 13:22 ` [PATCH 07/73] perf tools: Rename perf_evlist__exit() to evlist__exit() Jiri Olsa
2019-09-13 13:22 ` [PATCH 08/73] perf tools: Rename perf_evlist__purge() to evlist__purge() Jiri Olsa
2019-09-13 13:22 ` [PATCH 09/73] libperf: Link libapi.a in libperf.so Jiri Olsa
2019-09-13 13:22 ` [PATCH 10/73] libperf: Add perf_mmap struct Jiri Olsa
2019-09-23 15:05   ` Arnaldo Carvalho de Melo
2019-09-23 15:09     ` Jiri Olsa
2019-09-13 13:22 ` [PATCH 11/73] libperf: Add mask to struct perf_mmap Jiri Olsa
2019-09-13 13:22 ` [PATCH 12/73] libperf: Add fd " Jiri Olsa
2019-09-13 13:22 ` [PATCH 13/73] libperf: Add cpu " Jiri Olsa
2019-09-13 13:22 ` [PATCH 14/73] libperf: Add refcnt " Jiri Olsa
2019-09-13 13:22 ` [PATCH 15/73] libperf: Add prev/start/end " Jiri Olsa
2019-09-13 13:22 ` [PATCH 16/73] libperf: Add overwrite " Jiri Olsa
2019-09-13 13:22 ` [PATCH 17/73] libperf: Add event_copy " Jiri Olsa
2019-09-13 13:23 ` [PATCH 18/73] libperf: Add flush " Jiri Olsa
2019-09-13 13:23 ` Jiri Olsa [this message]
2019-09-23 18:08   ` [PATCH 19/73] libperf: Move system_wide from struct evsel to struct perf_evsel Arnaldo Carvalho de Melo
2019-09-13 13:23 ` [PATCH 20/73] libperf: Move nr_mmaps from struct evlist to struct perf_evlist Jiri Olsa
2019-09-13 13:23 ` [PATCH 21/73] libperf: Move mmap_len " Jiri Olsa
2019-09-13 13:23 ` [PATCH 22/73] libperf: Move pollfd " Jiri Olsa
2019-09-13 13:23 ` [PATCH 23/73] libperf: Move sample_id from struct evsel to struct perf_evsel Jiri Olsa
2019-09-13 13:23 ` [PATCH 24/73] libperf: Move id " Jiri Olsa
2019-09-13 13:23 ` [PATCH 25/73] libperf: Move ids " Jiri Olsa
2019-09-13 13:23 ` [PATCH 26/73] libperf: Move heads from struct evlist to struct perf_evlist Jiri Olsa
2019-09-13 13:23 ` [PATCH 27/73] libperf: Add perf_evsel__alloc_id/perf_evsel__free_id functions Jiri Olsa
2019-09-13 13:23 ` [PATCH 28/73] libperf: Add perf_evlist__first/last functions Jiri Olsa
2019-09-13 13:23 ` [PATCH 29/73] libperf: Add perf_evlist__read_format function Jiri Olsa
2019-09-13 13:23 ` [PATCH 30/73] libperf: Add perf_evlist__id_add function Jiri Olsa
2019-09-13 13:23 ` [PATCH 31/73] libperf: Add perf_evlist__id_add_fd function Jiri Olsa
2019-09-13 13:23 ` [PATCH 32/73] libperf: Move page_size into libperf Jiri Olsa
2019-09-23 19:10   ` Arnaldo Carvalho de Melo
2019-09-23 19:17     ` Jiri Olsa
2019-09-13 13:23 ` [PATCH 33/73] libperf: Merge libperf_set_print in libperf_init Jiri Olsa
2019-09-13 13:23 ` [PATCH 34/73] libperf: Add libperf_init call to tests Jiri Olsa
2019-09-13 13:23 ` [PATCH 35/73] libperf: Add libperf dependency for tests targets Jiri Olsa
2019-09-13 13:23 ` [PATCH 36/73] libperf: Add perf_evlist__alloc_pollfd function Jiri Olsa
2019-09-13 13:23 ` [PATCH 37/73] libperf: Add perf_evlist__add_pollfd function Jiri Olsa
2019-09-13 13:23 ` [PATCH 38/73] libperf: Add perf_evlist__poll function Jiri Olsa
2019-09-13 13:23 ` [PATCH 39/73] libperf: Add perf_mmap__init function Jiri Olsa
2019-09-13 13:23 ` [PATCH 40/73] libperf: Add struct perf_mmap_param Jiri Olsa
2019-09-13 13:23 ` [PATCH 41/73] libperf: Add perf_mmap__mmap_len function Jiri Olsa
2019-09-13 13:23 ` [PATCH 42/73] libperf: Add perf_mmap__mmap function Jiri Olsa
2019-09-13 13:23 ` [PATCH 43/73] libperf: Add perf_mmap__get function Jiri Olsa
2019-09-13 13:23 ` [PATCH 44/73] libperf: Add perf_mmap__unmap function Jiri Olsa
2019-09-13 13:23 ` [PATCH 45/73] libperf: Add perf_mmap__put function Jiri Olsa
2019-09-13 13:23 ` [PATCH 46/73] libperf: Add perf_mmap__new function Jiri Olsa
2019-09-13 13:23 ` [PATCH 47/73] perf tools: Use perf_mmap way to detect aux mmap Jiri Olsa
2019-09-13 13:23 ` [PATCH 48/73] libperf: Add perf_mmap__consume function Jiri Olsa
2019-09-13 13:23 ` [PATCH 49/73] libperf: Add perf_mmap__read_init function Jiri Olsa
2019-09-13 13:23 ` [PATCH 50/73] libperf: Add perf_mmap__read_done function Jiri Olsa
2019-09-13 13:23 ` [PATCH 51/73] libperf: Add perf_mmap__read_event function Jiri Olsa
2019-09-13 13:23 ` [PATCH 52/73] libperf: Add perf_evlist__mmap/munmap function Jiri Olsa
2019-09-13 13:23 ` [PATCH 53/73] libperf: Add perf_evlist__mmap_ops function Jiri Olsa
2019-09-13 13:23 ` [PATCH 54/73] libperf: Add perf_evlist_mmap_ops::idx callback Jiri Olsa
2019-09-13 13:23 ` [PATCH 55/73] libperf: Add perf_evlist_mmap_ops::new callback Jiri Olsa
2019-09-13 13:23 ` [PATCH 56/73] libperf: Add perf_evlist_mmap_ops::mmap callback Jiri Olsa
2019-09-13 13:23 ` [PATCH 57/73] perf tools: Add perf_evlist__mmap_cb_idx function Jiri Olsa
2019-09-13 13:23 ` [PATCH 58/73] perf tools: Add perf_evlist__mmap_cb_new function Jiri Olsa
2019-09-13 13:23 ` [PATCH 59/73] perf tools: Add perf_evlist__mmap_cb_mmap function Jiri Olsa
2019-09-13 13:23 ` [PATCH 60/73] perf tools: Switch to libperf mmap interface Jiri Olsa
2019-09-13 13:23 ` [PATCH 61/73] libperf: Move pollfd allocation to libperf Jiri Olsa
2019-09-13 13:23 ` [PATCH 62/73] libperf: Add perf_evlist__exit function Jiri Olsa
2019-09-13 13:23 ` [PATCH 63/73] libperf: Add perf_evlist__purge function Jiri Olsa
2019-09-13 13:23 ` [PATCH 64/73] libperf: Call perf_evlist__munmap/close on perf_evlist__delete Jiri Olsa
2019-09-13 13:23 ` [PATCH 65/73] libperf: Add perf_evlist__filter_pollfd function Jiri Olsa
2019-09-13 13:23 ` [PATCH 66/73] libperf: Add perf_evlist__for_each_mmap function Jiri Olsa
2019-09-13 13:23 ` [PATCH 67/73] libperf: Link static tests with libapi.a Jiri Olsa
2019-09-13 13:23 ` [PATCH 68/73] libperf: Add _GNU_SOURCE define to compilation Jiri Olsa
2019-09-13 13:23 ` [PATCH 69/73] libperf: Add tests_mmap_thread test Jiri Olsa
2019-09-13 13:23 ` [PATCH 70/73] libperf: Add tests_mmap_cpus test Jiri Olsa
2019-09-13 13:23 ` [PATCH 71/73] libperf: Keep count of failed tests Jiri Olsa
2019-09-13 13:23 ` [PATCH 72/73] libperf: Do not export perf_evsel__init/perf_evlist__init Jiri Olsa
2019-09-13 13:23 ` [PATCH 73/73] libperf: Add pr_err macro Jiri Olsa
2019-09-22 14:47 ` [RFC 00/73] libperf: Add sampling interface Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913132355.21634-20-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).