Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp993984rwi; Fri, 14 Oct 2022 11:14:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5a94jWbCdcPuuDQcGKBTho4bWD1iA0ZMl6PuxCtLcD/2D24UhGFOCoHQAieh1GMdM6H0n7 X-Received: by 2002:a17:907:9815:b0:78e:4b6:1afb with SMTP id ji21-20020a170907981500b0078e04b61afbmr4472476ejc.291.1665771279343; Fri, 14 Oct 2022 11:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665771279; cv=none; d=google.com; s=arc-20160816; b=c0lAxteGAtYwQJzutJBwA4/h9o30+hnHbp9lWfBZaVwUpRPBUd7iZs5ehySGYuEcwh fvGFvyLiQQB9StcmskuBcFtYv0qZ/Ep/yzy+yjHk0dSmbAsQMMQMiMYmhBHetRfObvTy rurRsCFRFjhVdElBUgNVPYLq6GFiBGprZyIkHQ9xckYjs3vR9Jq6G8E96nTRJN1Y/86m rmxFHCGrjQW0ZOH53QaM+WaQ6NWWl5d0C5SjUkrK8tkGAViKEqU6ZLzfPHdz4AYaTW0J x9PNIIegMVXHYW4Yy4yYH7pGWV5GIabVwquMxOAinCmpH2bp0KeG94arWj+muHf437dj kA7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=rzfkpk16B1bdFYhVEMVjYdQPtrAb81fMcKTxh0OhDTk=; b=VN7JzbzpojF28nS8F+oTwkhJ5vUXmUaeM6o84zVEgRTezMlk8vu9dlzrV093CXFX5f w9KQEBdzrLJGKKcYb4CktYZPHo1iolz98+5bqaU0PrAo+AbMsMw/opWLdxcC6Td+Vdr+ A6N8/mlKqZuqf8NrFE+AvLqh8wlwKcQtJLs9sOjj56k1SHbcFSxRa8sTObwe9WJbDrQB 5KXGtZZNN7ySP4NLZRcS0zHPNZ1bL295o9KdDMxGQU2/wBocjzugYMv2c6ty/aseaZix KOuOTi8tX44nZmg/smT+GNOyan+4XKzm6CaVa+Fw1pmZtvg2tlbtCAR9ssI0JXe+fM8j dAHA== ARC-Authentication-Results: i=1; mx.google.com; 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 nc9-20020a1709071c0900b0078e27f2ef52si1593086ejc.603.2022.10.14.11.14.12; Fri, 14 Oct 2022 11:14:39 -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; 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 S229978AbiJNSK3 (ORCPT + 99 others); Fri, 14 Oct 2022 14:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbiJNSK2 (ORCPT ); Fri, 14 Oct 2022 14:10:28 -0400 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C0F402FB; Fri, 14 Oct 2022 11:10:26 -0700 (PDT) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-1326637be6eso6723100fac.13; Fri, 14 Oct 2022 11:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rzfkpk16B1bdFYhVEMVjYdQPtrAb81fMcKTxh0OhDTk=; b=aPxMTRfPfbAkL4g9pNzSSEsezg7ZobkfMYNeFwpSWsjdJwbZ++90U/BUPj1tQfU8EK 7Ts6QhB+YjODAleMlqtN16049YP4fHag7qDaRTCuAiI04TleV05GVuqk5PQ0ivo0IhVX FhDkKPtciptmdzH64/RiPnju/3oI4DDGcgVle1K7dXPJ7eF/S5QWKa8QPcSGNZKg6QBQ EsAwkTycOBVsnvXqio2yxow5WsPUI+QMXJr54nvKuOw8JgkhEOTyNj3IpsFjhUlYbDe3 hrjOtg78wW+7ZN4CyU0GEvcDVsj4PS4DQxSC6D2Yt/kw0NtzPM6a3IyeJStHi34k8RTy biAg== X-Gm-Message-State: ACrzQf2pYDke90KmcbCrbQX0WpjYmKdYg40FfJq7tUduB6khhyRZ1ytR pCD2aRQpJVMaAaiEEqmzOjfS05RTBl9ZupovpA4= X-Received: by 2002:a05:6870:4184:b0:136:5e73:b40e with SMTP id y4-20020a056870418400b001365e73b40emr3347363oac.209.1665771025964; Fri, 14 Oct 2022 11:10:25 -0700 (PDT) MIME-Version: 1.0 References: <20221014061550.463644-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Fri, 14 Oct 2022 11:10:14 -0700 Message-ID: Subject: Re: [PATCHSET 00/19] perf stat: Cleanup counter aggregation (v2) To: Jiri Olsa Cc: Michael Petlan , Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users , Kan Liang , Leo Yan , Andi Kleen , Athira Rajeev , James Clark , Xing Zhengjun Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 Hi Jiri and Michael, On Thu, Oct 13, 2022 at 11:56 PM Jiri Olsa wrote: > > On Thu, Oct 13, 2022 at 11:15:31PM -0700, Namhyung Kim wrote: > > Hello, > > > > Current perf stat code is somewhat hard to follow since it handles > > many combinations of PMUs/events for given display and aggregation > > options. This is my attempt to clean it up a little. ;-) > > > > changes in v2) > > * fix a segfault in perf stat report for per-process record (Jiri) > > * fix metric only display (Jiri) > > * add evsel__reset_aggr_stat (ian) > > * add more comments (Ian) > > * add Acked-by from Ian > > > > My first concern is that aggregation and display routines are intermixed > > and processed differently depends on the aggregation mode. I'd like to > > separate them apart and make the logic clearer. > > > > To do that, I added struct perf_stat_aggr to save the aggregated counter > > values and other info. It'll be allocated and processed according to > > the aggr_mode and display logic will use it. > > > > I've tested the following combination. > > > > $ cat test-matrix.sh > > #!/bin/sh > > > > set -e > > > > yes > /dev/null & > > TARGET=$! > > > > ./perf stat true > > ./perf stat -a true > > ./perf stat -C0 true > > ./perf stat -p $TARGET true > > ./perf stat -t $TARGET true > > > > ./perf stat -a -A true > > ./perf stat -a --per-node true > > ./perf stat -a --per-socket true > > ./perf stat -a --per-die true > > ./perf stat -a --per-core true > > ./perf stat -a --per-thread true > > > > ./perf stat -a -I 500 sleep 1 > > ./perf stat -a -I 500 --summary sleep 1 > > ./perf stat -a -I 500 --per-socket sleep 1 > > ./perf stat -a -I 500 --summary --per-socket sleep 1 > > > > ./perf stat -a --metric-only true > > ./perf stat -a --metric-only --per-socket true > > ./perf stat -a --metric-only -I 500 sleep 1 > > ./perf stat -a --metric-only -I 500 --per-socket sleep 1 > > > > ./perf stat record true && ./perf stat report > > ./perf stat record -p $TARGET true && ./perf stat report > > ./perf stat record -a true && ./perf stat report > > ./perf stat record -a --per-core true && ./perf stat report > > ./perf stat record -a --per-core --metric-only true && ./perf stat report > > ./perf stat record -a -I 500 sleep 1 && ./perf stat report > > ./perf stat record -a -I 500 --per-core sleep 1 && ./perf stat report > > ./perf stat record -a -I 500 --per-core --metric-only sleep 1 && ./perf stat report > > > > ./perf stat -a -A -e cpu/event=cpu-cycles,percore/ true > > ./perf stat -a -A -e cpu/event=cpu-cycles,percore/ --percore-show-thread true > > > > kill $TARGET > > > > The code is available at 'perf/stat-aggr-v2' branch in > > > > git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git > > Michael, > ay chance you could run your test suite on top of this change? I've noticed there's an issue with cgroups. Will send a fix soon. Thanks, Namhyung