Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1247380ybj; Thu, 7 May 2020 19:05:33 -0700 (PDT) X-Google-Smtp-Source: APiQypI0BW7KLo1W75QsdvilsSmuCwiAEyzkYVJVAo2HR0MD+f4LB80TYrabbjpZna6Lm+BML/BN X-Received: by 2002:a05:6402:154e:: with SMTP id p14mr263954edx.326.1588903533603; Thu, 07 May 2020 19:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588903533; cv=none; d=google.com; s=arc-20160816; b=m+cp9E11wr8BMmjcdZqdEamRnZpgfrHEptDzFCo45gCu2u4qDjYqE4oFHDY2WKD75z VpuDh4PhwgjL8tu5UhU3J1QS1K1qw8P8wFEVcr2kKim4iwJB5ZKYIla23v+ojUF//WH7 j8LloJKGYgE8mzdCbEEGLP2d6rznTn5ikpyt3cdVcVa2D6mYnrJZYFCp8FQiCrkVOruQ 6c3i/WQyfcHoxZo6JnAsTX6k13ECjH9DZNjQ2DtR9M8AHNZYneilVp3jRbeUoCX2iNZs gIRwpgdpo+jdMnfH2zp219macTVPY8Uunsbp9RpNrLO2qV3yqdhzLQ9VJ9rmVvOrXmZ6 9S/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=UTOTp9OqVpCpeM1LQdoDq+n8Wo4R4qQfhtRVhtZM4Io=; b=RxFkO0Cgpd/y5h1n8RlB9og4lg3jCxs2Nvp27uSWwtyJ8NRPp5iiqhDSQO8UEDv9XW KrkNmgHJHEnel4SYxz+S1sL3Twd/ZkTlsh14gYuGzDpALEgHD4ef/4nYUzguwgwFkFwH gFxOaxexwdLi0IXSZZdF+2vNvRIvV5bfJ/SJnAP0HvTQ/yKdhPwpzuNtIMTN0d9bVjVL /IVgHuu1ue8WlDDhGVuK8og1krG8OzUmDgLg1ZFIq86MwXqbi/QH3iKiq/Qqy1eR8//q 9aOSIjmdQSk/DArnZmP1VvrXFnsWRyrxqjGINH6guT+WPeLO0Zjf45ylgl4wp1qQyRSY Auuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z70si139572ede.463.2020.05.07.19.05.10; Thu, 07 May 2020 19:05:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgEHCDg (ORCPT + 99 others); Thu, 7 May 2020 22:03:36 -0400 Received: from mga09.intel.com ([134.134.136.24]:49304 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbgEHCDg (ORCPT ); Thu, 7 May 2020 22:03:36 -0400 IronPort-SDR: XrnOrlsuBSK0hfcOuD9+g7QLjCE2jILqOZF8WQvc18ajYQ7rL5S9I8VjdRWfITfYSrIjT5QLNv 0qbg9av5FdfQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 19:03:34 -0700 IronPort-SDR: bWkDiNSVm8GbpzdQBrJkQ64jnnFB/+2Mwvzm271SGgiyGhZUoEpLbz7+gLbzVZjXrkuvv8d8+e fTxkoNi2pjVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="370303981" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.238.5.239]) ([10.238.5.239]) by fmsmga001.fm.intel.com with ESMTP; 07 May 2020 19:03:32 -0700 Subject: Re: [PATCH v3 1/4] perf stat: Fix wrong per-thread runtime stat for interval mode 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: <20200507065822.8255-1-yao.jin@linux.intel.com> <20200507065822.8255-2-yao.jin@linux.intel.com> <20200507151919.GE2804092@krava> From: "Jin, Yao" Message-ID: Date: Fri, 8 May 2020 10:03:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200507151919.GE2804092@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 5/7/2020 11:19 PM, Jiri Olsa wrote: > On Thu, May 07, 2020 at 02:58:19PM +0800, Jin Yao wrote: > > SNIP > >> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c >> index e0c1ad23c768..97ee941649e6 100644 >> --- a/tools/perf/builtin-stat.c >> +++ b/tools/perf/builtin-stat.c >> @@ -351,6 +351,16 @@ static void read_counters(struct timespec *rs) >> } >> } >> >> +static void thread_stats_reset(struct perf_stat_config *config) >> +{ >> + int i; >> + >> + if (config->stats) { >> + for (i = 0; i < config->stats_num; i++) >> + perf_stat__reset_shadow_per_stat(&config->stats[i]); >> + } >> +} >> + >> static void process_interval(void) >> { >> struct timespec ts, rs; >> @@ -359,6 +369,7 @@ static void process_interval(void) >> diff_timespec(&rs, &ts, &ref_time); >> >> perf_stat__reset_shadow_per_stat(&rt_stat); >> + thread_stats_reset(&stat_config); > > can't you call in here perf_stat__reset_stats? > If we call perf_stat__reset_stat here, it will reset the evsel->counts, but I don't think it's necessary. The counts will be updated in read_counts() soon. > and if not, I know it's threads related, but new > and delete functions are: > > runtime_stat_new, runtime_stat_delete > > so let's call it runtime_stat_reset and place it next to > the new/delete functions > Yes, that's good idea. I will create runtime_stat_reset and place it next to untime_stat_new/runtime_stat_delete. > other than that it looks ok, thanks > > jirka > Thanks! Thanks Jin Yao >> read_counters(&rs); >> >> if (STAT_RECORD) { >> -- >> 2.17.1 >> >