Re: [PATCH 34/40] perf report: Parallelize perf report using multi-thread

From: Namhyung Kim
Date: Tue May 19 2015 - 10:59:51 EST


On Tue, May 19, 2015 at 12:12:30PM +0200, Jiri Olsa wrote:
> On Mon, May 18, 2015 at 09:30:49AM +0900, Namhyung Kim wrote:
>
> SNIP
>
> > +
> > +int perf_session__process_events_mt(struct perf_session *session, void *arg)
> > +{
> > + struct perf_data_file *file = session->file;
> > + struct perf_evlist *evlist = session->evlist;
> > + struct perf_evsel *evsel;
> > + u64 nr_entries = 0;
> > + struct perf_tool *tool = session->tool;
> > + struct perf_session *mt_sessions = NULL;
> > + struct perf_tool_mt *mt_tools = NULL;
> > + struct perf_session *ms;
> > + struct perf_tool_mt *mt;
> > + pthread_t *th_id;
> > + int err, i, k;
> > + int nr_index = session->header.nr_index;
> > + u64 size = perf_data_file__size(file);
> > +
>
> SNIP
>
> > +
> > + for (i = 1; i < nr_index; i++) {
> > + mt = &mt_tools[i];
> > +
> > + evlist__for_each(evlist, evsel) {
> > + struct hists *hists = evsel__hists(evsel);
> > +
> > + if (perf_evsel__is_dummy_tracking(evsel))
> > + continue;
> > +
> > + hists__mt_resort(hists, &mt->hists[evsel->idx]);
> > +
> > + /* Non-group events are considered as leader */
> > + if (symbol_conf.event_group &&
> > + !perf_evsel__is_group_leader(evsel)) {
> > + struct hists *leader_hists;
> > +
> > + leader_hists = evsel__hists(evsel->leader);
> > + hists__match(leader_hists, hists);
> > + hists__link(leader_hists, hists);
>
> hum, could you please describe/comment on why is this needed?

This is because it skips report__collapse_hists() when multi-thread
processing is enabled. For multi-thread, it needs to collect
per-thread hists into a global hists. This step is very similar to
hists__collapse_resort() and called regardless of sort keys, so it
skips to call the report__collapse_hists().

But I think it should be called after collapsing all per-thread hists.
I'll move it out of the loop.

Thanks,
Namhyung
--
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/