Re: [PATCH 07/11] perf session: Add __perf_session__process_dir_events function

From: Jiri Olsa
Date: Sat Mar 09 2019 - 12:26:49 EST


On Fri, Mar 08, 2019 at 03:38:05PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> > + /* Read data from the header file.. */
> > + ret = reader__process_events(&rd, session, &prog);
> > + if (ret)
> > + goto out_err;
> > +
> > + /* ... and continue with data files. */
> > + for (i = 0; i < data->dir.nr ; i++) {
> > + struct perf_data_file *file = &data->dir.files[i];
> > +
> > + if (file->size == 0)
> > + continue;
> > +
> > + rd = (struct reader) {
> > + .fd = file->fd,
> > + .data_size = file->size,
> > + .data_offset = 0,
> > + .process = process_index,
> > + };
> > +
> > + ret = reader__process_events(&rd, session, &prog);
> > + if (ret)
> > + goto out_err;
>
> Don't we have to have some handling of PERF_RECORD_FINISHED_ROUND here?
> I.e. what happens if we fill th ordered events with just the contents
> of, say, the first CPU and then have those events flushed and processed
> before we start even looking at the events in the other CPUs?

PERF_RECORD_FINISHED_ROUND is disabled for directory data,
because each file contains sorted cpu data, so we only
merge them together

>
> I think some detailed explanation of what happens here is in need, no?

right, I'll put the comment for the function

jirka