[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1526648260-30540-2-git-send-email-yao.jin@linux.intel.com>
Date: Fri, 18 May 2018 20:57:38 +0800
From: Jin Yao <yao.jin@...ux.intel.com>
To: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com
Cc: Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
kan.liang@...el.com, yao.jin@...el.com,
Jin Yao <yao.jin@...ux.intel.com>
Subject: [PATCH v2 1/3] perf evlist: Create a new function perf_evlist_forced_leader
For non-explicit group, perf report supports a option '--group'
which can enable group output. We also need to support perf annotate
with the same '--group'.
Create a new function perf_evlist_forced_leader which contains
common code to force setting the group leader.
Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
tools/perf/util/evlist.c | 10 ++++++++++
tools/perf/util/evlist.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a59281d..ed8a9d5 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1795,3 +1795,13 @@ bool perf_evlist__exclude_kernel(struct perf_evlist *evlist)
return true;
}
+
+void perf_evlist_forced_leader(struct perf_evlist *evlist)
+{
+ if (!evlist->nr_groups) {
+ struct perf_evsel *leader = perf_evlist__first(evlist);
+
+ perf_evlist__set_leader(evlist);
+ leader->forced_leader = true;
+ }
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 6c41b2f..d77d514 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -309,4 +309,7 @@ struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
union perf_event *event);
bool perf_evlist__exclude_kernel(struct perf_evlist *evlist);
+
+void perf_evlist_forced_leader(struct perf_evlist *evlist);
+
#endif /* __PERF_EVLIST_H */
--
2.7.4
Powered by blists - more mailing lists