Re: [PATCH v1 2/5] perf, tools: Save event scaling factors in perf.data

From: Jiri Olsa
Date: Mon Nov 13 2017 - 04:02:47 EST


On Thu, Nov 09, 2017 at 06:55:25AM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> To process metrics, perf script needs to know the scaling
> factors reported by sysfs for events. Save the scaling factors
> in the perf.data metadata in a new SCALE header.
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

there's event_update event for scale and some other evsel stuff
that was before we were able to put header through pipe

it might be less code changes.. sythesize it via:

if (has_scale(counter)) {
err = perf_event__synthesize_event_update_scale(NULL, counter, process_synthesized_event);
if (err < 0) {
pr_err("Couldn't synthesize evsel scale.\n");
return err;
}
}

and new tool's event_update callback, which is already implemented
in perf_event__process_event_update

having event instead of header feature might have
other drawbacks.. not sure it will fit here

jirka