Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2237728rwd; Fri, 16 Jun 2023 00:48:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+n3PAQH6hcrUY0os+8+Jmvv9hcCTWb1yK9aUwg8EVS/UZR5JhEm/jLpj8ZbGHGoMH2qpN X-Received: by 2002:a05:6a20:1443:b0:116:99fe:e674 with SMTP id a3-20020a056a20144300b0011699fee674mr1977925pzi.9.1686901734586; Fri, 16 Jun 2023 00:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686901734; cv=none; d=google.com; s=arc-20160816; b=zrsAe+njBTsfMP3qGb4+YqJFf3FJG8b+Q7qpwII0bEeF0HjspbQXl/0hDkbgjghbcM P9psYB1NRGz6xTmODbm2MsSuKgXuy8J+4ex/toJnGiYlv0jCJOluH6E13YIhsmKsfDIt PgvWQUtBE7TR/UPE9wz5YcjjRlwqEZ3ptON2GhgFzXW8qRqAJAMLUyOppBl/hE0THAIb FVtsxfiEsiesRkO8Ur1Z5br5h9j54f25i+8zeRHsTqVHRlGADM20apvpyJ5i3usN3jQQ LOPw/WaOxoJC6WPZ5y7JPna92GsHXB76xIvtLzK3wMILE8hCiy/VXbY/n26CK4JUIscL t3LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=zoV8AIWoN8isNFc8d/A+grHcBDoOF9LX+RgpFHY7YR4=; b=baiA5RTiabzuLHzlP9nD+W74tByzzPdreDlZy7cEVARzfyIWg10sqqrgSVSlvgbU0A lhI2eJpgTVix4AqZmqowqS2rZ6RD54vnY2jC2qkugSKxEEFbyqf5DTM+Q6VmLFdxyZCF NzPw69H7pdzIWE5+f8tVB/rrigfUbCP4LTrR1gWiWTTeass/Y9kaAviJV5BmSJr+CowS ZvvoTebzaY73g31YMJac++NFs6cvfQX8ttUVvSpbGu+ixVC/jIQvqnz4oQl8MWNiTSf4 EcJH6hZ8Dy5JKErRKkC4YQ8X9wkjxvKny4ohi4kC1txGaFp33odp1tkmMQ8CYwaHmvKe uN3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Z2NZjr4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020aa7982c000000b006666cc2f03csi4355210pfl.296.2023.06.16.00.48.41; Fri, 16 Jun 2023 00:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Z2NZjr4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243668AbjFPHdK (ORCPT + 99 others); Fri, 16 Jun 2023 03:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241982AbjFPHcs (ORCPT ); Fri, 16 Jun 2023 03:32:48 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D356E30ED; Fri, 16 Jun 2023 00:32:14 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-54fb1bbc3f2so383599a12.0; Fri, 16 Jun 2023 00:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686900734; x=1689492734; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=zoV8AIWoN8isNFc8d/A+grHcBDoOF9LX+RgpFHY7YR4=; b=Z2NZjr4peOLLbax/erCsvvSUkW61U3Wq8uNLX2sXBySWtImwRKRH0BPrcEnGpbwDXG 6Pftto2cm2AFVztDmaNBC5gb9cuZeNmceuYIcJfSEutJYwBJezb58Ds3dW7N1yo9ITHm XwLSGAwLHAlFLKGWKR8c1YreRTrosD+MQliMwJuDFEB8E7H0mzD4iGfOayrHAOls5/QG 9A57CEWBjO4ly/HTqAM+hh6PKS9yK3jpAkfcl0deYvCVROCxv2jpaL9sviAtcHPxMTWL YjKJClSwAv4YpTupcMQoiOovak0K8ZVONLY8acUkCVxN5fqcFKx4ljnrlcnS1m/Ae5SX VhfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686900734; x=1689492734; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zoV8AIWoN8isNFc8d/A+grHcBDoOF9LX+RgpFHY7YR4=; b=AStsXqnzFRoJHrATP2JVw2lDb4H2cWBrp4r94EsEbqIFDwddyGrnMRyIfmalBK7Uvu cpF27aM5axUmwUC4hVy1LEm1od+0H8gDDe7eeVk2D65F1jFyjn4JS2wpRRYFKG/vP64R KRuk6IqL4tnLIIYREN5lYQ3FdgNwCsMtH7BIM4umo4EvasYA5XRPzir0MEttGHhQFQW+ w2xHrTCThc8Ium+K3U+XjhHZ6b4NjBLSZXEkAcTm9b/8z4b5zTmWK4yv/Cjsk/nTc5/O jQ4RmZARV3EdfOvR4oQfovfXxkKvJlBk4Bq1/AbaWMsWx75Xtf5nk8NHjhx2UbrPVPik oPhg== X-Gm-Message-State: AC+VfDzNVLwTrCuM6FRP5KBYcrw7gdqsrME2vDZQA3W46GiaHMsTu6po UMyFbZWGzm7T5HjLlQDyloQ= X-Received: by 2002:a17:90b:250:b0:25b:f764:580a with SMTP id fz16-20020a17090b025000b0025bf764580amr1100888pjb.12.1686900734082; Fri, 16 Jun 2023 00:32:14 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6700:7f00:6cbb:2c15:7306:b23]) by smtp.gmail.com with ESMTPSA id gz10-20020a17090b0eca00b00256b67208b1sm715245pjb.56.2023.06.16.00.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 00:32:13 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Kan Liang , Andi Kleen Subject: [PATCH 1/2] perf stat: Reset aggr stats for each run Date: Fri, 16 Jun 2023 00:32:10 -0700 Message-ID: <20230616073211.1057936-1-namhyung@kernel.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When it runs multiple times with -r option, it missed to reset the aggregation counters and the values were added up. The aggregation count has the values to be printed in the end. It should reset the counters at the beginning of each run. But the current code does that only when -I/--interval-print option is given. Fixes: 91f85f98da7a ("perf stat: Display event stats using aggr counts") Reported-by: Jiri Olsa Signed-off-by: Namhyung Kim --- tools/perf/builtin-stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c87c6897edc9..e549862f90f0 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -725,6 +725,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) all_counters_use_bpf = false; } + evlist__reset_aggr_stats(evsel_list); + evlist__for_each_cpu(evlist_cpu_itr, evsel_list, affinity) { counter = evlist_cpu_itr.evsel; -- 2.41.0.162.gfafddb0af9-goog