提交 a64e018b 编写于 作者: A Andi Kleen 提交者: Greg Kroah-Hartman

perf stat: Make metric event lookup more robust

[ Upstream commit 145c407c808352acd625be793396fd4f33c794f8 ]

After setting up metric groups through the event parser, the metricgroup
code looks them up again in the event list.

Make sure we only look up events that haven't been used by some other
metric. The data structures currently cannot handle more than one metric
per event. This avoids problems with multiple events partially
overlapping.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Link: http://lkml.kernel.org/r/20190624193711.35241-2-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 7343178c
...@@ -303,7 +303,7 @@ static struct perf_evsel *perf_stat__find_event(struct perf_evlist *evsel_list, ...@@ -303,7 +303,7 @@ static struct perf_evsel *perf_stat__find_event(struct perf_evlist *evsel_list,
struct perf_evsel *c2; struct perf_evsel *c2;
evlist__for_each_entry (evsel_list, c2) { evlist__for_each_entry (evsel_list, c2) {
if (!strcasecmp(c2->name, name)) if (!strcasecmp(c2->name, name) && !c2->collect_stat)
return c2; return c2;
} }
return NULL; return NULL;
...@@ -342,7 +342,8 @@ void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list) ...@@ -342,7 +342,8 @@ void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list)
if (leader) { if (leader) {
/* Search in group */ /* Search in group */
for_each_group_member (oc, leader) { for_each_group_member (oc, leader) {
if (!strcasecmp(oc->name, metric_names[i])) { if (!strcasecmp(oc->name, metric_names[i]) &&
!oc->collect_stat) {
found = true; found = true;
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册