From: weiping zhang <zhangweiping@didichuxing.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<alexander.shishkin@linux.intel.com>, <jolsa@redhat.com>,
<namhyung@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-perf-users@vger.kernel.org>
Subject: [PATCH] perf cgroup: fix cgroup for multiple events
Date: Thu, 25 Jan 2018 23:00:21 +0800 [thread overview]
Message-ID: <20180125150017.GA15771@localhost.didichuxing.com> (raw)
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
next reply other threads:[~2018-01-25 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 15:00 weiping zhang [this message]
2018-01-26 0:10 ` weiping zhang
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=20180125150017.GA15771@localhost.didichuxing.com \
--to=zhangweiping@didichuxing.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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
Powered by JetHome