linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libperf: Fix read_size calculations
@ 2022-02-23 13:13 Tzvetomir Stoyanov (VMware)
  2022-02-23 13:59 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2022-02-23 13:13 UTC (permalink / raw)
  To: acme, olsajiri, irogers; +Cc: linux-perf-users

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


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

end of thread, other threads:[~2022-02-24  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 13:13 [PATCH] libperf: Fix read_size calculations Tzvetomir Stoyanov (VMware)
2022-02-23 13:59 ` Arnaldo Carvalho de Melo
2022-02-23 18:20   ` Jiri Olsa
2022-02-24  9:10     ` Tzvetomir Stoyanov

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).