Re: [PATCH v6 1/6] perf header: Record first sample time and last sample time in perf file header

From: Jin, Yao
Date: Tue Nov 21 2017 - 19:55:16 EST




On 11/22/2017 12:38 AM, Arnaldo Carvalho de Melo wrote:
Em Mon, Nov 06, 2017 at 08:21:06PM +0800, Jin Yao escreveu:
perf report/script/... have a --time option to limit the time range
of output. That's very useful to slice large traces, e.g. when processing
the output of perf script for some analysis.

But right now --time only supports absolute time. Also there is no fast
way to get the start/end times of a given trace except for looking at it.
This makes it hard to e.g. only decode the first half of the trace, which
is useful for parallelization of scripts

Another problem is that perf records are variable size and there is no
synchronization mechanism. So the only way to find the last sample reliably
would be to walk all samples. But we want to avoid that in perf report/...
because it is already quite expensive. That is why storing the first sample
time and last sample time in perf record is better.

This patch creates a new header feature type HEADER_SAMPLE_TIME and related
ops. Save the first sample time and the last sample time to the feature
section in perf file header

I'll add a clarification here, right after your text:

". That will be done when, for instance, processing build-ids, where we
already have to process all samples to create the build-id table, take
advantage of that to further amortize that processing by storing
HEADER_SAMPLE_TIME to make 'perf report/script' faster when using
--time."


Thanks Arnaldo! The clarification is good!

Thanks
Jin Yao