From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752115AbdKVFi7 (ORCPT ); Wed, 22 Nov 2017 00:38:59 -0500 Received: from mga11.intel.com ([192.55.52.93]:49576 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdKVFi6 (ORCPT ); Wed, 22 Nov 2017 00:38:58 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="4624585" Subject: Re: [PATCH v1 8/9] perf stat: Remove --per-thread pid/tid limitation To: Jiri Olsa Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <1511189024-19908-1-git-send-email-yao.jin@linux.intel.com> <1511189024-19908-9-git-send-email-yao.jin@linux.intel.com> <20171121151831.GM20440@krava> From: "Jin, Yao" Message-ID: Date: Wed, 22 Nov 2017 13:38:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171121151831.GM20440@krava> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2017 11:18 PM, Jiri Olsa wrote: > On Mon, Nov 20, 2017 at 10:43:43PM +0800, Jin Yao wrote: >> Currently, if we execute 'perf stat --per-thread' without specifying >> pid/tid, perf will return error. >> >> root@skl:/tmp# perf stat --per-thread >> The --per-thread option is only available when monitoring via -p -t options. >> -p, --pid stat events on existing process id >> -t, --tid stat events on existing thread id >> >> This patch removes this limitation. If no pid/tid specified, it returns >> all threads (get threads from /proc). >> >> Signed-off-by: Jin Yao >> --- >> tools/perf/builtin-stat.c | 23 +++++++++++++++-------- >> tools/perf/util/target.h | 7 +++++++ >> 2 files changed, 22 insertions(+), 8 deletions(-) >> >> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c >> index 9eec145..2d718f7 100644 >> --- a/tools/perf/builtin-stat.c >> +++ b/tools/perf/builtin-stat.c >> @@ -277,7 +277,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) >> attr->enable_on_exec = 1; >> } >> >> - if (target__has_cpu(&target)) >> + if (target__has_cpu(&target) && !target__has_per_thread(&target)) > > please add comment on why this is needed.. > >> return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel)); >> >> return perf_evsel__open_per_thread(evsel, evsel_list->threads); >> @@ -340,7 +340,7 @@ static int read_counter(struct perf_evsel *counter) >> int nthreads = thread_map__nr(evsel_list->threads); >> int ncpus, cpu, thread; >> >> - if (target__has_cpu(&target)) >> + if (target__has_cpu(&target) && !target__has_per_thread(&target)) > > same here > That's because this patch series doesn't support cpu_list yet. So if it's a cpu_list case, then skip. I plan to add cpu_list supporting as follow-up patch to avoid adding too much in this patch series. Thanks Jin Yao > thanks, > jirka >