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

thanks,
jirka

Reply via email to