Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp822733ybj; Thu, 7 May 2020 08:23:59 -0700 (PDT) X-Google-Smtp-Source: APiQypIYVhM1J/y1vy8jTiiA0+puOJpAmaAdSAgT3xtZKbVk9p9bEnaupcfssxLmAllRddPM2wZf X-Received: by 2002:a05:6402:3094:: with SMTP id de20mr12550379edb.158.1588865039727; Thu, 07 May 2020 08:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588865039; cv=none; d=google.com; s=arc-20160816; b=SNdnfcDl831Lg5umc6jIF3vt7g+p4FslRR55pn0bC4gpL+ExaWDbMXti8rVEirLhWT 13y7UhiSk5ezH+0p8A7tKKUzCperzl68TpN6JFJhOQkdrPDDVXAgA097QDK+Qoypapnq Sn9DTcIm2S8t6tL6tUzk1R5iIUITw1VCk9B5LUA5Gv5A1cCRJg/OTIg5f7vH1Wd5yLHD okSBr2/NvgkEOVU11B0sY+R7nm5o4i7liigK7s93AmH31MhLtPwtw3IhxGOsQL1S7SUn NHTkGt0h8ssRS8Yp9GS1vhB3yHXtexAqyvR5625grvi0BklTaZtt6TXg/yuksL27GtAE zhug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cStW6qIKyhYd/UHlHbB5Zz+wLlj28FxKEQuFmjwQOS8=; b=AJB4DM9aiTX5oaBZlw29uF7qhES8pGIzFsAWlCxYqdHQ2nEYBTgimhnJ1jRYtoWjQ7 fdE04KONf+1k+JePVzEnHqicxErun9KoEwS6zIE8zOq/y2YaGe3VDo+C94gDhPEATIP7 lNfn6MN57JedkC0lgnvp1o4ZrvPoTLYrnm9iOBPbbnJfE2bpDJ1tEfw6O85MFOlekfte wJdp94r/olhvW1RCUD1DbCzsyeS4PN6eIb1mO0fdScwI+a4gZKwrLtRI7S4+PKF3mNIb JXTKOEGEw4vNQiPSGD5SOWwc6m0X9PTREwKSepoU9oizmgsLRS72Sg/j8CkCdVWlJumn XakA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SQMyzljK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si3447855edi.409.2020.05.07.08.23.36; Thu, 07 May 2020 08:23:59 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SQMyzljK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726743AbgEGPTd (ORCPT + 99 others); Thu, 7 May 2020 11:19:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59736 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725948AbgEGPTc (ORCPT ); Thu, 7 May 2020 11:19:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588864771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cStW6qIKyhYd/UHlHbB5Zz+wLlj28FxKEQuFmjwQOS8=; b=SQMyzljK4Uz0xQTNUmkoulc27aQTli0YHYiDXhYA+tqSVwbWmnzx9iZ+FRiNj2MES/QXut WUOwlodXxcYJo2RJhmxLo35jv6yrNtHipbsYVVPT5eJeHWRGAu2rBcVceM8FxJ/eA+ZJu4 axCwHkTyEP/Now04XjqJg3qBQl4oZU8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-QNQvlEAyOz6hTrzlOTvZkA-1; Thu, 07 May 2020 11:19:25 -0400 X-MC-Unique: QNQvlEAyOz6hTrzlOTvZkA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0095F835B41; Thu, 7 May 2020 15:19:24 +0000 (UTC) Received: from krava (unknown [10.40.194.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D08E41053B1C; Thu, 7 May 2020 15:19:21 +0000 (UTC) Date: Thu, 7 May 2020 17:19:19 +0200 From: Jiri Olsa To: Jin Yao 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 Subject: Re: [PATCH v3 1/4] perf stat: Fix wrong per-thread runtime stat for interval mode Message-ID: <20200507151919.GE2804092@krava> References: <20200507065822.8255-1-yao.jin@linux.intel.com> <20200507065822.8255-2-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200507065822.8255-2-yao.jin@linux.intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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 other than that it looks ok, thanks jirka > read_counters(&rs); > > if (STAT_RECORD) { > -- > 2.17.1 >