From: Jiri Olsa <olsajiri@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Ian Rogers <irogers@google.com>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 4/4] perf tools: Support reading PERF_FORMAT_LOST
Date: Fri, 19 Aug 2022 12:53:18 +0200 [thread overview]
Message-ID: <Yv9rnnHFQ7qxOsag@krava> (raw)
In-Reply-To: <20220819003644.508916-5-namhyung@kernel.org>
On Thu, Aug 18, 2022 at 05:36:44PM -0700, Namhyung Kim wrote:
SNIP
> static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread,
> - u64 val, u64 ena, u64 run)
> + u64 val, u64 ena, u64 run, u64 lost)
> {
> struct perf_counts_values *count;
>
> @@ -1550,6 +1550,7 @@ static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread,
> count->val = val;
> count->ena = ena;
> count->run = run;
> + count->lost = lost;
>
> perf_counts__set_loaded(counter->counts, cpu_map_idx, thread, true);
> }
> @@ -1558,7 +1559,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int
> {
> u64 read_format = leader->core.attr.read_format;
> struct sample_read_value *v;
> - u64 nr, ena = 0, run = 0, i;
> + u64 nr, ena = 0, run = 0, lost = 0;
>
> nr = *data++;
>
> @@ -1571,18 +1572,18 @@ static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int
> if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
> run = *data++;
>
> - v = (struct sample_read_value *) data;
> -
> - evsel__set_count(leader, cpu_map_idx, thread, v[0].value, ena, run);
> -
> - for (i = 1; i < nr; i++) {
> + v = (void *)data;
nit, we could leave the 'v' assignment above right?
jirka
> + sample_read_group__for_each(v, nr, read_format) {
> struct evsel *counter;
>
> - counter = evlist__id2evsel(leader->evlist, v[i].id);
> + counter = evlist__id2evsel(leader->evlist, v->id);
> if (!counter)
> return -EINVAL;
>
> - evsel__set_count(counter, cpu_map_idx, thread, v[i].value, ena, run);
> + if (read_format & PERF_FORMAT_LOST)
> + lost = v->lost;
> +
> + evsel__set_count(counter, cpu_map_idx, thread, v->value, ena, run, lost);
SNIP
next prev parent reply other threads:[~2022-08-19 10:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 0:36 [PATCH 0/4] perf tools: Support reading PERF_FORMAT_LOST (v3) Namhyung Kim
2022-08-19 0:36 ` [PATCH 1/4] tools headers UAPI: Sync linux/perf_event.h with the kernel sources Namhyung Kim
2022-08-19 0:36 ` [PATCH 2/4] tools lib perf: Handle read format in perf_evsel__read() Namhyung Kim
2022-08-19 0:36 ` [PATCH 3/4] tools lib perf: Add a test case for read formats Namhyung Kim
2022-08-19 0:36 ` [PATCH 4/4] perf tools: Support reading PERF_FORMAT_LOST Namhyung Kim
2022-08-19 10:53 ` Jiri Olsa [this message]
2022-08-19 17:25 ` [PATCH v3.1] " Namhyung Kim
2022-08-19 10:53 ` [PATCH 0/4] perf tools: Support reading PERF_FORMAT_LOST (v3) Jiri Olsa
2022-08-19 15:26 ` Arnaldo Carvalho de Melo
-- strict thread matches above, loose matches on Subject: below --
2022-08-16 22:17 [PATCH 0/4] perf tools: Support reading PERF_FORMAT_LOST (v2) Namhyung Kim
2022-08-16 22:17 ` [PATCH 4/4] perf tools: Support reading PERF_FORMAT_LOST Namhyung Kim
2022-08-18 12:04 ` Jiri Olsa
2022-08-18 16:59 ` Namhyung Kim
2022-08-15 19:01 [PATCH 0/4] " Namhyung Kim
2022-08-15 19:01 ` [PATCH 4/4] " Namhyung Kim
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=Yv9rnnHFQ7qxOsag@krava \
--to=olsajiri@gmail.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).