Re: [PATCH 01/16] perf tools: Add id index
From: Jiri Olsa
Date: Wed Oct 29 2014 - 04:55:54 EST
On Fri, Oct 24, 2014 at 10:25:02AM +0300, Adrian Hunter wrote:
> On 24/10/14 00:08, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Oct 23, 2014 at 01:45:09PM +0300, Adrian Hunter escreveu:
> >> Add an index of the event identifiers.
> >>
> >> This is needed to queue Instruction
> >> Trace samples according to the mmap
> >> buffer from which they were recorded.
> >
> > This gets difficult to review, I end up having to look at all the
> > patches together to figure out the use cases, to see if this here makes
> > sense...
> >
> > Can you try to explain like to a seven year old?
> >
> > Sigh.
> >
> > 'id' is somethig super vague, what does this identifies? I want to make
> > progress processing these patches, but with so short explanations like
> > the above one, it gets difficult.
>
> This is the event id (also called the sample id) which is a unique number
> allocated by the kernel to the event created by perf_event_open(). Events
> can include the event id by having a sample type including PERF_SAMPLE_ID or
> PERF_SAMPLE_IDENTIFIER.
>
> Currently the main use of the event id is to match an event back to the
> evsel to which it belongs i.e. perf_evlist__id2evsel()
>
> The purpose of this patch is to make it possible to match an event back to
> the mmap from which it was read. The reason that is useful is because the
> mmap represents a time-ordered context (either for a cpu or for a thread).
> Intel PT decodes trace information on that basis. In full-trace mode, that
> information can be recorded when the Intel PT trace is read, but in
> sample-mode the Intel PT trace data is embedded in a sample and it is in
> that case that the "id index" is needed.
>
> So the mmaps are numbered (idx) and the cpu and tid recorded against the id
> by perf_evlist__set_sid_idx() which is called by perf_evlist__mmap_per_evsel().
>
> That information is recorded on the perf.data file in the new "id index".
> idx, cpu and tid are added to struct perf_sample_id (which is the node of
> evlist's hash table to match ids to evsels). The information can be
> retrieved using perf_evlist__id2sid(). Note however this all depends on
> having a sample type including PERF_SAMPLE_ID or PERF_SAMPLE_IDENTIFIER,
> otherwise ids are not recorded.
>
> The "id index" is a synthesized event record which will be created when
> Intel PT sampling is used by calling perf_event__synthesize_id_index().
with above text in changelog:
Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/