From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751694AbdJRPjz (ORCPT ); Wed, 18 Oct 2017 11:39:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50900 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbdJRPjw (ORCPT ); Wed, 18 Oct 2017 11:39:52 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 960A67E381 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Wed, 18 Oct 2017 17:39:49 +0200 From: Jiri Olsa To: kan.liang@intel.com Cc: acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, jolsa@kernel.org, wangnan0@huawei.com, hekuang@huawei.com, namhyung@kernel.org, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, ak@linux.intel.com Subject: Re: [PATCH V2 4/5] perf record: synthesize event multithreading support Message-ID: <20171018153949.GC512@krava> References: <1508336973-383492-1-git-send-email-kan.liang@intel.com> <1508336973-383492-5-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1508336973-383492-5-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 18 Oct 2017 15:39:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 18, 2017 at 07:29:32AM -0700, kan.liang@intel.com wrote: SNIP > +static int record__multithread_synthesize(struct record *rec, > + struct machine *machine, > + struct perf_tool *tool, > + struct record_opts *opts) > +{ > + int i, err, nr_thread = sysconf(_SC_NPROCESSORS_ONLN); > + char name[PATH_MAX]; > + struct stat st; > + > + if (nr_thread <= 1) > + return __machine__synthesize_threads(machine, tool, > + &opts->target, > + rec->evlist->threads, > + process_synthesized_event, > + opts->sample_address, > + opts->proc_map_timeout, > + 1); ^^^^^^^^^^^^^^^^^^ > + > static int record__synthesize(struct record *rec, bool tail) > { > struct perf_session *session = rec->session; > @@ -766,9 +856,16 @@ static int record__synthesize(struct record *rec, bool tail) > perf_event__synthesize_guest_os, tool); > } > > - err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads, > - process_synthesized_event, opts->sample_address, > - opts->proc_map_timeout, 1); > + /* multithreading synthesize is only available for cpu monitoring */ > + if (target__has_cpu(&opts->target)) > + err = record__multithread_synthesize(rec, machine, tool, opts); > + else > + err = __machine__synthesize_threads(machine, tool, > + &opts->target, > + rec->evlist->threads, > + process_synthesized_event, > + opts->sample_address, > + opts->proc_map_timeout, 1); hum, this could be checked together with nr_thread in record__multithread_synthesize jirka