[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yv9rnnHFQ7qxOsag@krava>
Date: Fri, 19 Aug 2022 12:53:18 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 4/4] perf tools: Support reading PERF_FORMAT_LOST
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
Powered by blists - more mailing lists