From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: acme@kernel.org, olsajiri@gmail.com, irogers@google.com
Cc: linux-perf-users@vger.kernel.org
Subject: [PATCH] libperf: Fix read_size calculations
Date: Wed, 23 Feb 2022 15:13:49 +0200 [thread overview]
Message-ID: <20220223131349.134897-1-tz.stoyanov@gmail.com> (raw)
Reading the counters from perf descriptor fails because of size
mismatch when PERF_FORMAT_GROUP is set. The group count must include the
parent and the count of siblings.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
tools/lib/perf/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c
index 210ea7c06ce8..4597a53c0152 100644
--- a/tools/lib/perf/evsel.c
+++ b/tools/lib/perf/evsel.c
@@ -299,7 +299,7 @@ int perf_evsel__read_size(struct perf_evsel *evsel)
entry += sizeof(u64);
if (read_format & PERF_FORMAT_GROUP) {
- nr = evsel->nr_members;
+ nr += evsel->nr_members;
size += sizeof(u64);
}
--
2.34.1
next reply other threads:[~2022-02-23 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 13:13 Tzvetomir Stoyanov (VMware) [this message]
2022-02-23 13:59 ` [PATCH] libperf: Fix read_size calculations Arnaldo Carvalho de Melo
2022-02-23 18:20 ` Jiri Olsa
2022-02-24 9:10 ` Tzvetomir Stoyanov
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=20220223131349.134897-1-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=olsajiri@gmail.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).