From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964980AbbESO7s (ORCPT ); Tue, 19 May 2015 10:59:48 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:33516 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964947AbbESO7p (ORCPT ); Tue, 19 May 2015 10:59:45 -0400 Date: Tue, 19 May 2015 23:58:22 +0900 From: Namhyung Kim To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , David Ahern , Adrian Hunter , Andi Kleen , Frederic Weisbecker , Stephane Eranian Subject: Re: [PATCH 34/40] perf report: Parallelize perf report using multi-thread Message-ID: <20150519145822.GB29162@danjae.kornet> References: <1431909055-21442-1-git-send-email-namhyung@kernel.org> <1431909055-21442-35-git-send-email-namhyung@kernel.org> <20150519101230.GC22060@krava.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150519101230.GC22060@krava.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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