All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf cgroup: fix cgroup for multiple events
@ 2018-01-25 15:00 ` weiping zhang
  0 siblings, 0 replies; 3+ messages in thread
From: weiping zhang @ 2018-01-25 15:00 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung
  Cc: linux-kernel, linux-perf-users

if use -G and with multiple events, only the first event has
correct cgroup setting, all other events have a wroung setting.

reproduce:
mkdir -p /sys/fs/cgroup/perf_event/test
perf stat -e cycles -e cache-misses  -a -I 1000 -G test

before:
     1.001007226      <not counted>      cycles                    test
     1.001007226              7,506      cache-misses

after:
     1.000834097      <not counted>      cycles                    test
     1.000834097      <not counted>      cache-misses              test

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 tools/perf/util/cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index d9ffc1e..b50bfd1 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -137,7 +137,8 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
 
 	return -1;
 found:
-	counter->cgrp = cgrp;
+	evlist__for_each_entry(evlist, counter)
+		counter->cgrp = cgrp;
 	return 0;
 }
 
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-26  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 15:00 [PATCH] perf cgroup: fix cgroup for multiple events weiping zhang
2018-01-25 15:00 ` weiping zhang
2018-01-26  0:10 ` weiping zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.