Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6975685rwb; Tue, 15 Nov 2022 06:12:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4nI9HVJNsirytsYEGjMomTsVOg73bSbZkLyCxeIzA7VnMDIZZgEMenIEvzvtJhPD0fgYBj X-Received: by 2002:a63:6442:0:b0:43c:4724:186f with SMTP id y63-20020a636442000000b0043c4724186fmr15688551pgb.529.1668521571142; Tue, 15 Nov 2022 06:12:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668521571; cv=none; d=google.com; s=arc-20160816; b=GD8MwO2tulH2PYYlF9KtFv/hRK7eFPVV96WQGNhH1Cqxz8Yv9RIsiv/wzCu17477Hh ea//czEONaSbQAPVPQ22dhNWbdIM/ml9GvtXuXxfsUQVAS2lMSK2l3SnAjACKwFOntNx /HIXud+1fpbBUbcq2TIop22SWwLnAdm0ucB0llAYcWEVSOQW8EjBWy6GP9ZOLcqDJmAY hUzXmM6GMS/n2se8MBGVDGAHPQIF05dUqvupvotNrLSBJpVfMis5MURLscGZB2zAmee3 pjOeBtNFWcSdqjYaFdSib1NMS4LAczZXOb7vTASY1ADP1FQYhYl2OusmIH/mvu28Fb8r kXUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KGL1bGdds8h0T5YlOMp55DkxEiKUK9srvm8HiUcVeO8=; b=YaWr2pVLuKe81U9SCztSiArJ3LCH00Jc4qBvsxkbHDolBUDISj+a+OXIzP416EhGlx e+D7mdVgFAvsUxBTkleU8xJDJ1XnJ9GL8JtahfdMUpARXGVAv6tis+w5tEATHQ73DTzT n3GTiblcvWXA0lEGxjEUNCbT+DeyNNILh5KHeFylsruqPuSCrL9agiAA0AdRyXlUP7F2 UBCRr36cIUPUBeDRXCeGmbRLYe0MuVPipIYirEus5hq1Mb939hU9HY0saI0GZaWzTYT2 Q3e8dQk2TT1c3C0+KX2r8x8jDDp9hgLofnF1rCEGbqPnYIonLzYc+DlkXRDp0MXNRPQf bvkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BuVnbGVQ; 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 y9-20020a170902700900b00176a6c988c6si11396955plk.218.2022.11.15.06.12.39; Tue, 15 Nov 2022 06:12:51 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=BuVnbGVQ; 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 S229731AbiKOOEs (ORCPT + 89 others); Tue, 15 Nov 2022 09:04:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238496AbiKOOEi (ORCPT ); Tue, 15 Nov 2022 09:04:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 152452B1B8; Tue, 15 Nov 2022 06:04:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0CE96179B; Tue, 15 Nov 2022 14:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02317C433D7; Tue, 15 Nov 2022 14:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668521075; bh=6Qvlg1lMg7fGpa0P20E6tpgyxeNcsHw0v3LYS/R+ins=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BuVnbGVQaBDcYpT71SQqSB0uAmvRUAFOkRj21Wbt7EacCJ0FIaRRRiQ30gUhbqYyn hAv9PGVP4xcMdCqQc7V/nrbje1A50Wdwg4ZES0NWj+dDNOEczihuH+lh4MPLLW2pPT j0zIaf/kWvZHjl14AjWvXe72W76fRd/F+/IZ2nDQDXPMd4FRCCfPONz2n3mgNVpKWP yYaberTyw1cGR9GUf94FnGfKGcLDp4YeslxH9PEkI64JNUDrpHv1VhAkWyeTEKfhId vUib+maSyDdUiqKFxtmLQGRyotiTCgRA9Xn5tflkwB3TfuYwp97lW7yUPOrXu13Yna nAzwfaND15YXA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id B7B13407ED; Tue, 15 Nov 2022 11:04:31 -0300 (-03) Date: Tue, 15 Nov 2022 11:04:31 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark , Athira Jajeev Subject: Re: [PATCHSET 00/19] perf stat: Improve perf stat output (v1) Message-ID: References: <20221114230227.1255976-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221114230227.1255976-1-namhyung@kernel.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Em Mon, Nov 14, 2022 at 03:02:08PM -0800, Namhyung Kim escreveu: > Hello, > > I'm working on cleanup up the perf stat code. The main focus this time > is the display logic which has various combinations of options. > > I split the code for each output mode - std, csv and json. And then > organize them according to the purpose like header, prefix, value, > metric and footer. I hope this would help maintaining the code a bit > more. > > Also I found that cgroup support is missing or insufficient. > Specifically when --for-each-cgroup option is given, it'd have multiple > copies of the events for those cgroups. Then the output should group > the result. This is true for the normal output mode, but the metric- > only mode didn't support it well. > > With this change, I can see the per-cgroup topdown metrics like below: > > $ sudo ./perf stat -a --topdown --for-each-cgroup user.slice,system.slice sleep 3 > nmi_watchdog enabled with topdown. May give wrong results. > Disable with echo 0 > /proc/sys/kernel/nmi_watchdog > > Performance counter stats for 'system wide': > > retiring bad speculation frontend bound backend bound > S0-D0-C0 2 user.slice 117.3% 3.9% 47.8% -69.1% > S0-D0-C1 2 user.slice 119.8% 4.1% 49.3% -73.2% > S0-D0-C2 2 user.slice 24.4% 7.9% 68.4% 0.0% > S0-D0-C3 2 user.slice 24.0% 9.2% 91.2% -24.4% > S0-D0-C0 2 system.slice 73.5% 4.0% 19.4% 3.1% > S0-D0-C1 2 system.slice 90.0% 5.8% 19.7% -15.5% > S0-D0-C2 2 system.slice 101.2% 6.6% 33.4% -41.1% > S0-D0-C3 2 system.slice 90.7% 4.9% 22.3% -18.0% > > 3.001678216 seconds time elapsed > > You can get it from 'perf/stat-display-v1' branch in > > git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git applied locally, build testing. - Arnaldo > Thanks, > Namhyung > > Namhyung Kim (19): > perf stat: Clear screen only if output file is a tty > perf stat: Split print_running() function > perf stat: Split print_noise_pct() function > perf stat: Split print_cgroup() function > perf stat: Split aggr_printout() function > perf stat: Factor out print_counter_value() function > perf stat: Handle bad events in abs_printout() > perf stat: Add before_metric argument > perf stat: Align cgroup names > perf stat: Split print_metric_headers() function > perf stat: Factor out prepare_interval() > perf stat: Cleanup interval print alignment > perf stat: Remove impossible condition > perf stat: Rework header display > perf stat: Move condition to print_footer() > perf stat: Factor out prefix display > perf stat: Factor out print_metric_{begin,end}() > perf stat: Support --for-each-cgroup and --metric-only > perf stat: Add print_aggr_cgroup() for --for-each-cgroup and --topdown > > tools/perf/builtin-stat.c | 8 + > tools/perf/util/stat-display.c | 996 ++++++++++++++++++++------------- > 2 files changed, 624 insertions(+), 380 deletions(-) > > > base-commit: 7565f9617efac0c0c8e2dbd08dbe0695d56684f5 > -- > 2.38.1.493.g58b659f92b-goog -- - Arnaldo