Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2694946ybk; Mon, 18 May 2020 05:51:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEUpIbqXFC/wkHyXFYGO3EZm/1Y78EvSjMKGERjlif9bThm8BocSjKvWSdXFa0r9z8mr4A X-Received: by 2002:aa7:c617:: with SMTP id h23mr12872175edq.305.1589806298136; Mon, 18 May 2020 05:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589806298; cv=none; d=google.com; s=arc-20160816; b=tJoZ/d8SwdV6+Khnnvz0nuFj2tl/iLfE4M2ddFuIHzWsXvTQcRqg53e8B9IdOhU3xK czj4ndV6KtWqdC7AcwMDCKdSP61vGiMzBUy6rPC+V3Oklr88q7od8p84WHpX9B+uraIl 3bTkV5Ui1dXz5+aB/nja3G6bhGpLqAnbSfNT1xI/ILQyPjaA1HY21H8qPlA8PcTYWfJW ubEbVt1Qlhg3KW/V3louIlm9kFInjEw/nASC45p4UiaJV4+xoG9CMI0MH8bmyDx4Zp6N lBKzyvqoZd17VfwUO6K+9CJz+3x8lLKwrxd9MMBeeKrGTqVc8IrDxAzQkT203b7SyUN+ RIkw== 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=QI2DoCSTQmt9XKvtjloRdVpvqfICFbfiGQ5z/yfchF8=; b=heRqxQ/3ZDcE9qNys8SNr8/OP2GqyAUK0S5DW2ZpuJV7Hk4X0uZzSCRCd3kI9NtWZW 6ZNljNpZr5R24+0iiiuK+gTdaoVjbDkzTkCKgjS+xBNZvNHyeqNGx11CPATYUpBFbVjT QRCtYFGJCPE2najls9fO2OIntGtbTCLVoh35MVIy0rPKl1Fwua7Fyy2WOdk6yKwXtLVo m2xz0+kqHhzsW7h4QS+3RAW1RTxb05dDaA9RJOgn2aOKxbUpWi0R/9kGdHSiBpzoNORF SqSu2VM0DiAuTrXcN2Cw7f7VcWs0kfXvWjn5MyYqfnGUg67XJb8mSsgVntQRsQH6xqXQ cDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="EG/u1VV8"; 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 z3si2299097ejm.403.2020.05.18.05.51.14; Mon, 18 May 2020 05:51:38 -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="EG/u1VV8"; 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 S1726945AbgERMro (ORCPT + 99 others); Mon, 18 May 2020 08:47:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59534 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726709AbgERMro (ORCPT ); Mon, 18 May 2020 08:47:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589806062; 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=QI2DoCSTQmt9XKvtjloRdVpvqfICFbfiGQ5z/yfchF8=; b=EG/u1VV8fuxk6MFxaWNAeed4z5W6vKzMk8t5EBgiqygbG1A5gb0zYddjjifDuMN963o6OL 6kLThaeWtTixLpM7FBhCRiT3ESZfsrt3k1ewm7EOYJXnydHKhV6IDe7+UuGdarxzMTkbrv jqVl+EXNBv186MWD+vvYJEod5QdKdD0= 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-332-ETIEU4NpOXqWqc28cxVnBw-1; Mon, 18 May 2020 08:47:38 -0400 X-MC-Unique: ETIEU4NpOXqWqc28cxVnBw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20162107ACCA; Mon, 18 May 2020 12:47:37 +0000 (UTC) Received: from krava (unknown [10.40.196.18]) by smtp.corp.redhat.com (Postfix) with SMTP id 76D4A5C1B2; Mon, 18 May 2020 12:47:33 +0000 (UTC) Date: Mon, 18 May 2020 14:47:32 +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 v5 5/5] perf stat: Report summary for interval mode Message-ID: <20200518124732.GE3726797@krava> References: <20200514053638.3736-1-yao.jin@linux.intel.com> <20200514053638.3736-6-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514053638.3736-6-yao.jin@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 01:36:38PM +0800, Jin Yao wrote: SNIP > > evlist__for_each_entry(evsel_list, counter) { > if (counter->err) > @@ -394,6 +403,7 @@ static void runtime_stat_reset(struct perf_stat_config *config) > static void process_interval(void) > { > struct timespec ts, rs; > + struct stats walltime_nsecs_stats_bak; > > clock_gettime(CLOCK_MONOTONIC, &ts); > diff_timespec(&rs, &ts, &ref_time); > @@ -407,9 +417,11 @@ static void process_interval(void) > pr_err("failed to write stat round event\n"); > } > > + walltime_nsecs_stats_bak = walltime_nsecs_stats; > init_stats(&walltime_nsecs_stats); > update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000); > print_counters(&rs, 0, NULL); > + walltime_nsecs_stats = walltime_nsecs_stats_bak; could we instead of above initialize walltime_nsecs_stats in the condition below, like: init_stats(&walltime_nsecs_stats); update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000); jirka > } > > static void enable_counters(void) > @@ -765,6 +777,19 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) > > update_stats(&walltime_nsecs_stats, t1 - t0); > > + if (interval) { > + stat_config.interval = 0; > + stat_config.summary = true; > + > + if (stat_config.aggr_mode == AGGR_GLOBAL) > + perf_evlist__save_aggr_prev_raw_counts(evsel_list); > + > + perf_evlist__copy_prev_raw_counts(evsel_list); > + perf_evlist__reset_prev_raw_counts(evsel_list); > + runtime_stat_reset(&stat_config); > + perf_stat__reset_shadow_per_stat(&rt_stat); > + } > + SNIP