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

From: Arnaldo Carvalho de Melo
Date: Fri Mar 08 2019 - 13:39:51 EST


Em Fri, Mar 08, 2019 at 03:38:05PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Mar 08, 2019 at 02:47:41PM +0100, Jiri Olsa escreveu:
> > +static int __perf_session__process_dir_events(struct perf_session *session)
> > +{
> > + struct perf_data *data = session->data;
> > + struct perf_tool *tool = session->tool;
> > + struct reader rd = {
> > + .fd = perf_data__fd(session->data),
> > + .data_size = session->header.data_size,
> > + .data_offset = session->header.data_offset,
> > + .process = process_simple,
> > + };
> > + int i, ret = 0;
> > + struct ui_progress prog;
> > + u64 total_size = perf_data__size(session->data);
> > +
> > + perf_tool__fill_defaults(tool);
> > +
> > + ui_progress__init_size(&prog, total_size, "Processing events...");
> > +
> > + /* 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?

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

Ah, I've pushed what I have merged so far to acme/perf/core on
git.kernel.org, please continue from there.

- Arnaldo