From patchwork Sat Nov 12 03:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089530wru; Fri, 11 Nov 2022 19:24:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TvOQkjL5jkjHzgt68wEevcQBUU/sYq4omCXNd1L5EllwTsJw/akwWYrw2jC7w1bRkIRGG X-Received: by 2002:a17:906:434f:b0:7a6:fc0f:6fe6 with SMTP id z15-20020a170906434f00b007a6fc0f6fe6mr3829032ejm.694.1668223454261; Fri, 11 Nov 2022 19:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223454; cv=none; d=google.com; s=arc-20160816; b=M4H6Gfnuhv38fXVnnW6+cd+GvJ8004xUoxbeaQQIGCRYSLHO5wcT0k3zu8bz/ISKWs iBCosChuKC2c4ofCF9HqxsuBr4KEwsbGmV/vMBus7qmLs5LVmg1PmfCi3YiBnV6kLA5j Zrau4jwYSrN/oCyNb2F3ybwW2/HwDIdoJMugrAgMd++/P690FSjc4hTFfA2aH1I4zs4E 3KSzsa4zBfSV4boIFnWaax/lHY7wEeuVsseqeJ1REgW26k8J6D9AW0gqiVAvHRKup/pP vEZDPIbbiM8hHEMKNZvO7wlwx6Gr3Q59e0GNaF4ScBwJXAqSYN5nmi+l1L7KABgHAwt3 oMpg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=C4bJLYWvXE58HDtdnb3171bguBeaFjpiGBBqDJTpgS5/XiEl98IY4zWDqzz75LHRMO ymxk5GMWOylgcQQ5srRQ8j70HSauumyYDtm29EVL0/seL8ksyQxc9HaF7CoJdYEgkPyO vrmtwSbwNZIGgO5OMneD+PC9fVK+ztiymMofjU+56+vxikdU7Xk/joZx7Qd7n10oCycE oPQgVaDnidhuGQlF8I63te9oyIR0HIZFczoovvFnWxvXWCmAaQ7jbpP43alQbDxDuKWu 6E/OCG/W/VoEc1s6BNE8uTmQa5WcrDc+/YQPRIHF+2VvaKzKKuFBqHHExdt9cjf0J3q+ TtWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UsCcGGDG; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a50c315000000b00461ea502defsi1167103edb.350.2022.11.11.19.23.50; Fri, 11 Nov 2022 19:24:14 -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=@gmail.com header.s=20210112 header.b=UsCcGGDG; 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 S234545AbiKLDXG (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234250AbiKLDW4 (ORCPT ); Fri, 11 Nov 2022 22:22:56 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F536BDEF; Fri, 11 Nov 2022 19:22:55 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso9259941pjg.5; Fri, 11 Nov 2022 19:22:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=UsCcGGDGGhfTo+D44aLiaSYlWe2328dlot3oI5NEGpGnSb++qvwFNLDtlB+UVBqMML hhuFPLzTUf0ejOG1uhfd2GVH2OW1/J/haXHpDOh2z5HFmTZ5Y1lkWietE5VrqNlYgvdn Cece/NY/SjugMB6Adrg6ZqsR3YZJltAOybC5zSAZSmSK2VsOIQqMH1C58NHJXyGzOIGm pjd456XTbMWqTL9IH6g9+fmcEQV409Q+VyFaVePZq71r4R3hfGvzyBGU+xLVY7J7QLy9 bYI/LLd8uHPO1arOSrNvreagsxk2gBTsfBWt2vYa7kuHHitCl749LNwWCov+5EnC9MV9 KQ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=I8K9Mh3/56fWmHSV6vaKPfoyuSEydBYsEYb5uFu7Q6DBUSHVJAX1+0bqjtHoQJiPqd E1HlVBvdL2p37tdtouNR/mFlwa+7QVtB2iW+eTuefYOlSLc5SzXdtlII+j+vxOQVCWTC /w/jodvh07feuSO9ZOgrymwJABri9UmViInNOmSyd+Jobf4UwEorvyEIYPX4WaXt78Ff 8imMll0G3N9W0hs979tnTDCOJdYAjDX3N7qjKJdHwpQClP60Etpi58wKjkIe090gAuc3 T9ujCggjIoKEXDUytJPzwD03gUcoPp+btrATy+AA/BsxpkbYxxqPQE+e5rLbN+piwXgu CF6A== X-Gm-Message-State: ANoB5pk45tgBXJDKVJJ60qHnN0YvIuwycJWSXiwwCqJIgs2ySrZuYi1q Gt98HK5Olv7JzbPqmCPEirU= X-Received: by 2002:a17:902:c651:b0:187:3bc8:fc56 with SMTP id s17-20020a170902c65100b001873bc8fc56mr4956125pls.83.1668223374900; Fri, 11 Nov 2022 19:22:54 -0800 (PST) Received: from balhae.roam.corp.google.com ([2607:fb90:27dc:8408:33d7:3b01:eee1:84b]) by smtp.gmail.com with ESMTPSA id ij25-20020a170902ab5900b00186f0f59d1esm2434552plb.192.2022.11.11.19.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:54 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark Subject: [PATCH 04/11] perf stat: Increase metric length to align outputs Date: Fri, 11 Nov 2022 19:22:37 -0800 Message-Id: <20221112032244.1077370-5-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221112032244.1077370-1-namhyung@kernel.org> References: <20221112032244.1077370-1-namhyung@kernel.org> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749259076756848728?= X-GMAIL-MSGID: =?utf-8?q?1749259076756848728?= When perf stat is called with very detailed events, the output doesn't align well like below: $ sudo perf stat -a -ddd sleep 1 Performance counter stats for 'system wide': 8,020.23 msec cpu-clock # 7.997 CPUs utilized 3,970 context-switches # 494.998 /sec 169 cpu-migrations # 21.072 /sec 586 page-faults # 73.065 /sec 649,568,060 cycles # 0.081 GHz (30.42%) 304,044,345 instructions # 0.47 insn per cycle (38.40%) 60,313,022 branches # 7.520 M/sec (38.89%) 2,766,919 branch-misses # 4.59% of all branches (39.26%) 74,422,951 L1-dcache-loads # 9.279 M/sec (39.39%) 8,025,568 L1-dcache-load-misses # 10.78% of all L1-dcache accesses (39.22%) 3,314,995 LLC-loads # 413.329 K/sec (30.83%) 1,225,619 LLC-load-misses # 36.97% of all LL-cache accesses (30.45%) L1-icache-loads 20,420,493 L1-icache-load-misses # 0.00% of all L1-icache accesses (30.29%) 58,017,947 dTLB-loads # 7.234 M/sec (30.37%) 704,677 dTLB-load-misses # 1.21% of all dTLB cache accesses (30.27%) 234,225 iTLB-loads # 29.204 K/sec (30.29%) 417,166 iTLB-load-misses # 178.10% of all iTLB cache accesses (30.32%) L1-dcache-prefetches L1-dcache-prefetch-misses 1.002947355 seconds time elapsed Increase the METRIC_LEN by 3 so that it can align properly. $ sudo ./perf stat -a -ddd true Performance counter stats for 'system wide': 233.70 msec cpu-clock # 11.714 CPUs utilized 320 context-switches # 1.369 K/sec 31 cpu-migrations # 132.648 /sec 482 page-faults # 2.062 K/sec 38,414,140 cycles # 0.164 GHz (6.65%) 13,656,335 instructions # 0.36 insn per cycle (20.31%) 3,594,871 branches # 15.382 M/sec (34.06%) 124,071 branch-misses # 3.45% of all branches (47.74%) 14,016,847 L1-dcache-loads # 59.977 M/sec (61.42%) 789,534 L1-dcache-load-misses # 5.63% of all L1-dcache accesses (65.98%) 315,353 LLC-loads # 1.349 M/sec (47.13%) 171,244 LLC-load-misses # 54.30% of all LL-cache accesses (41.98%) L1-icache-loads 2,591,299 L1-icache-load-misses # 0.00% of all L1-icache accesses (36.10%) 60,421,987 dTLB-loads # 258.543 M/sec (27.47%) 123,843 dTLB-load-misses # 0.20% of all dTLB cache accesses (18.88%) 38,289 iTLB-loads # 163.837 K/sec (10.34%) 21,631 iTLB-load-misses # 56.49% of all iTLB cache accesses (2.53%) L1-dcache-prefetches L1-dcache-prefetch-misses Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 96ad0c71adc2..3ddc159df4b2 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -218,7 +218,7 @@ struct outstate { struct evsel *evsel; }; -#define METRIC_LEN 35 +#define METRIC_LEN 38 static void new_line_std(struct perf_stat_config *config __maybe_unused, void *ctx)