Messages in this thread | | | Date | Mon, 13 Nov 2017 15:23:11 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCH v1 5/5] perf, tools, script: Allow computing metrics in perf script |
| |
Em Mon, Nov 13, 2017 at 10:30:11AM +0100, Jiri Olsa escreveu: > On Thu, Nov 09, 2017 at 06:55:28AM -0800, Andi Kleen wrote: > > SNIP > > > static void process_event(struct perf_script *script, > > struct perf_sample *sample, struct perf_evsel *evsel, > > struct addr_location *al, > > @@ -1481,6 +1560,9 @@ static void process_event(struct perf_script *script, > > if (PRINT_FIELD(PHYS_ADDR)) > > printf("%16" PRIx64, sample->phys_addr); > > printf("\n"); > > + > > + if (PRINT_FIELD(METRIC)) > > + print_metric(script, thread, evsel, sample); > > } > > > > static struct scripting_ops *scripting_ops; > > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > > index 25f21cde8826..27a72b883645 100644 > > --- a/tools/perf/util/evsel.h > > +++ b/tools/perf/util/evsel.h > > @@ -108,6 +108,8 @@ struct perf_evsel { > > struct cpu_map *cpus; > > struct cpu_map *own_cpus; > > struct thread_map *threads; > > + u64 val; > > + int gnum; > > please put this to the priv (struct perf_stat_evsel) > with some comments that it's used in script only > > also there's per event dump feature that uses evsel->priv > (please rebase to latest Arnaldo's perf/core) in script, > so make sure you are mutualy exclusive
No need, priv is supposed to be used by one tool only, i.e. its a too private area, that perf_evsel_stats thing started to be used by multiple tools, so I moved it to perf_evsel->stats and made perf_evsel->priv be a tool priv area again.
I.e. move the above values to perf_stat_evsel and access it via evsel->stats.
- Arnaldo
> thanks, > jirka
| |