linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/18] perf evlist: Move perf_evsel__reset_weak_group into evlist
Date: Tue,  6 Nov 2018 09:06:00 -0300	[thread overview]
Message-ID: <20181106120612.8262-7-acme@kernel.org> (raw)
In-Reply-To: <20181106120612.8262-1-acme@kernel.org>

From: Andi Kleen <ak@linux.intel.com>

- Move the function from builtin-stat to evlist for reuse
- Rename to evlist to match purpose better
- Pass the evlist as first argument.
- No functional changes

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20181001195927.14211-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 28 +---------------------------
 tools/perf/util/evlist.c  | 27 +++++++++++++++++++++++++++
 tools/perf/util/evlist.h  |  3 +++
 3 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d1028d7755bb..a635abfa77b6 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -383,32 +383,6 @@ static bool perf_evsel__should_store_id(struct perf_evsel *counter)
 	return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID;
 }
 
-static struct perf_evsel *perf_evsel__reset_weak_group(struct perf_evsel *evsel)
-{
-	struct perf_evsel *c2, *leader;
-	bool is_open = true;
-
-	leader = evsel->leader;
-	pr_debug("Weak group for %s/%d failed\n",
-			leader->name, leader->nr_members);
-
-	/*
-	 * for_each_group_member doesn't work here because it doesn't
-	 * include the first entry.
-	 */
-	evlist__for_each_entry(evsel_list, c2) {
-		if (c2 == evsel)
-			is_open = false;
-		if (c2->leader == leader) {
-			if (is_open)
-				perf_evsel__close(c2);
-			c2->leader = c2;
-			c2->nr_members = 0;
-		}
-	}
-	return leader;
-}
-
 static bool is_target_alive(struct target *_target,
 			    struct thread_map *threads)
 {
@@ -477,7 +451,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
 			if ((errno == EINVAL || errno == EBADF) &&
 			    counter->leader != counter &&
 			    counter->weak_group) {
-				counter = perf_evsel__reset_weak_group(counter);
+				counter = perf_evlist__reset_weak_group(evsel_list, counter);
 				goto try_again;
 			}
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e88e6f9b1463..668d2a9ef0f4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1810,3 +1810,30 @@ void perf_evlist__force_leader(struct perf_evlist *evlist)
 		leader->forced_leader = true;
 	}
 }
+
+struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evsel_list,
+						 struct perf_evsel *evsel)
+{
+	struct perf_evsel *c2, *leader;
+	bool is_open = true;
+
+	leader = evsel->leader;
+	pr_debug("Weak group for %s/%d failed\n",
+			leader->name, leader->nr_members);
+
+	/*
+	 * for_each_group_member doesn't work here because it doesn't
+	 * include the first entry.
+	 */
+	evlist__for_each_entry(evsel_list, c2) {
+		if (c2 == evsel)
+			is_open = false;
+		if (c2->leader == leader) {
+			if (is_open)
+				perf_evsel__close(c2);
+			c2->leader = c2;
+			c2->nr_members = 0;
+		}
+	}
+	return leader;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index dc66436add98..9919eed6d15b 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -312,4 +312,7 @@ bool perf_evlist__exclude_kernel(struct perf_evlist *evlist);
 
 void perf_evlist__force_leader(struct perf_evlist *evlist);
 
+struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evlist,
+						 struct perf_evsel *evsel);
+
 #endif /* __PERF_EVLIST_H */
-- 
2.14.4

  parent reply	other threads:[~2018-11-06 12:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 12:05 [GIT PULL 00/18] perf/urgent improvements and fixes Arnaldo Carvalho de Melo
2018-11-06 12:05 ` [PATCH 01/18] tools headers barrier: Fix arm64 tools build failure wrt smp_load_{acquire,release} Arnaldo Carvalho de Melo
2018-11-06 12:05 ` [PATCH 02/18] perf examples bpf: Start augmenting raw_syscalls:sys_{start,exit} Arnaldo Carvalho de Melo
2018-11-06 12:05 ` [PATCH 03/18] perf trace: When augmenting raw_syscalls plug raw_syscalls:sys_exit too Arnaldo Carvalho de Melo
2018-11-06 12:05 ` [PATCH 04/18] perf trace: Fix setting of augmented payload when using eBPF + raw_syscalls Arnaldo Carvalho de Melo
2018-11-06 12:05 ` [PATCH 05/18] perf augmented_syscalls: Start collecting pathnames in the BPF program Arnaldo Carvalho de Melo
2018-11-06 12:06 ` Arnaldo Carvalho de Melo [this message]
2018-11-06 12:06 ` [PATCH 07/18] perf record: Support weak groups Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 08/18] perf stat: Handle different PMU names with common prefix Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 09/18] perf top: Display the LBR stats in callchain entry Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 10/18] perf scripts python: exported-sql-viewer.py: Fall back to /usr/local/lib/libxed.so Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 11/18] perf scripts python: exported-sql-viewer.py: Add Selected branches report Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 12/18] perf scripts python: exported-sql-viewer.py: Add help window Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 13/18] perf scripts python: exported-sql-viewer.py: Fix table find when table re-ordered Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 14/18] perf intel-pt: Add more event information to debug log Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 15/18] perf intel-pt: Add MTC and CYC timestamps " Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 16/18] perf beauty: Use SRCARCH, ARCH=x86_64 must map to "x86" to find the headers Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 17/18] perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so Arnaldo Carvalho de Melo
2018-11-06 12:06 ` [PATCH 18/18] perf tools: Do not zero sample_id_all for group members Arnaldo Carvalho de Melo
2018-11-06 19:06 ` [GIT PULL 00/18] perf/urgent improvements and fixes Ingo Molnar

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=20181106120612.8262-7-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=williams@redhat.com \
    /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).