Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp279419lqo; Thu, 9 May 2024 22:13:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGf+hsEdZoiPqdMlWVM+LpiLrV/mffsKV4MbRjAeqCZPFhX7Iu8JqnTDflFIMTucrU6yVKnAsfs0iLU4Lo5H6BtxxoR79AO1IqhnEG3Q== X-Google-Smtp-Source: AGHT+IGOo8FGumf7tA8NLNaMC17In0mXJYF3hDUOHj4eN9P77jCDciR+AocTX68dBTFmtSOllxsV X-Received: by 2002:a17:907:7b8a:b0:a59:9b8e:aa61 with SMTP id a640c23a62f3a-a5a2d5c9303mr113101666b.35.1715318003376; Thu, 09 May 2024 22:13:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715318003; cv=pass; d=google.com; s=arc-20160816; b=Ob0v5/4KmySIu3xv51bk3yb6jF/DeH44MN7H22AaST77/nT5zHNROR5Py8t8vI9rRT Dtvjj6LjJZ86pZJSz0aornaCPK27o2Wl2I82Du2I1Qu/XvDqLFc7paRQnxqdYp4C7JdF C3OTIW7u2ozxfiHalmHYm4gxjj00JrYMMy4y3IwDABEHs/yeEvJRRCItKuocSSn4jvz4 bMyz0tYeeXOulTapWPO0ZKxS3TgBvj/bYlCtX01YLtFPsRTkeDHPFcawISfZohHcqHVT RphzWaN0Ba6DoABmmz0oU+K3GZTpvTl4BwEjnZ/Zu3ndcwJiZNX4wJbgo3i0cIWd5pJL mJqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=OKjQVp3FAUgk+ze053pkAabzKwTqf9LXD3i69ugyhcQ=; fh=abR9H1Vd88tXXcth6ukBzwB6w/AiGvCP2aVgwfQjziM=; b=Ll65d3Bplc8CL5DFXl/ThvrY/FcBao5Ql1d39aG/fKvzpzlUJG5UJCT8JGq+BKOGQk 2CJQnD0jS4dsQbySINJDtAhHq1vdHVfj2ZCmkjzGArhW/dMFGWWl5nfv+DyLYluYe4Jy HS/Cxar20+9elghjnSBw6Ctg+Wkey8Sg6VQ3uvib4KlHHUOuHawUClxqORj5Wt4fimhB bAttSOFtsm5Qb75swq2rTy9K2jRsQgiB3//lGs/82ug0yXTlM5ziYxYBm3sSXCAoydmJ nVa5VxeFABGu7lmfBxNtWng8zCE1R9KG5HSU/1kWz8tkmZ3uR7dPTgXrOidFsp6chUvn 0cxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BhKEHf6b; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-175283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1794603dsi141504766b.10.2024.05.09.22.13.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 22:13:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BhKEHf6b; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-175283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 18E0F1F21FE6 for ; Fri, 10 May 2024 05:13:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5F531509AB; Fri, 10 May 2024 05:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BhKEHf6b" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79E65548EC for ; Fri, 10 May 2024 05:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715317994; cv=none; b=jrPWbiLSM1nX8nD4LlYvGtoJSW3CMMKt7EMSqHZuHOdI5NJUOgj08iGYBOLVQnoghT+EfSaM5OlORSXEbwXHX6yV+Jh2QQcE0b7dw5EAUlxbxC/bT1HAjc9NM0gIM9RRWp6Pw0b2BB0TfH/etrTSIK8YA257Mugou2duGb9IgJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715317994; c=relaxed/simple; bh=2CSSuDANH+DI3ZSn1/F+R7LCv62bfHS4CcN1mcJHHl0=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=CaiqX0ivNrk5RJTxcX5xjv294jxFH6oMWsUX+mSkjsQpZjwQZ/+hmbfqNaTkc6vq7iNExg8JACZU45/V2WnsaUFGiDUgw3fG/cUuI/G2cJUaSFEhrxS/oSguCuBDE3k0SbHfZ3/HK24EZ0CizW/VrmxroNDnOceo8FCN/OFnE4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BhKEHf6b; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6dbdcfd39so2949535276.2 for ; Thu, 09 May 2024 22:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715317992; x=1715922792; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=OKjQVp3FAUgk+ze053pkAabzKwTqf9LXD3i69ugyhcQ=; b=BhKEHf6bd0kN0LlV9WIEzc2zpWFB3f95GDz68qlfhx996R9+2nnU9+xkWni/2P2ksc 6ly3W/+dYZPL2sAao4imnuu87oliWZFLmqUQcjdAVyKpAa8HiEK28+bIBu723yDmbJ34 oQV8QDTcDOCFrodkRlcFzN6rrr9RMBwVmmoJPLP5WwZmO/bufTqcRTYsn8asfsU9zNZK wwGPIogd3i9pis/OzZYI2FZfgUkBlSKxZhcFRFB5Leu4oUml9OvLW5PB5ALcz/cyV/z6 W21nlvvn6sSroVoZWfLsQiHfw2xGcZnKSp7rY9jFAmR4Dm6znrGPrjVuM+ZneKrE1Wui snCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715317992; x=1715922792; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OKjQVp3FAUgk+ze053pkAabzKwTqf9LXD3i69ugyhcQ=; b=qAjafST5hAFcL3NZWzVF9hPerlq3youXW7X9ZPg6hznXpMoKwZ5e5L9yC28Dxgjiyq fwSSMahf61MW1VTxnUREO4FPb5bt6Vw8ND3JlboMFTo0JF0/caNcJhA1cMh33n6sASF3 e8tUha/qx4k56sNocix1mySDQ/09u1vb5mRhYfaI0CvXVOXzxG1x6LMlyp1eOhBk6t8c AxNWtTtKmwG+AOWXifMLEMEvpcJC+tkUGpovz62z8CPItd88+XUSaQtSXIPn4mZpjGIv PywnntUi2AgO0967fuCf1khu41W6JFZ7eGrbO3qormCruBsAa5W4nTiFS+29JV0vdHEw eWQQ== X-Forwarded-Encrypted: i=1; AJvYcCUm3rlg2ommGaNQZyhh32uNcW+W+mNk1tjoXVLRrJyssqyPgHukeZjWRegJAvR5x10xDdQVRTM9nxzg72XCtS682cYzxQfJ4+xkGTr4 X-Gm-Message-State: AOJu0YwTrE6WH/NKZePYb64JIPwixCitqZN9dBb2TPROJGlWGU36WKOD OJWnLvRJF1TSk7Lp4G+SgtMiSCF/cWWxGu2m/WDNigQl8E9CTD86pb3i6CjOookPSvtxeUV7caB kS1t9Dg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:79ed:c375:51e3:ed39]) (user=irogers job=sendgmr) by 2002:a05:6902:1081:b0:de5:53a9:384a with SMTP id 3f1490d57ef6-dee4f53a18emr445869276.13.1715317992474; Thu, 09 May 2024 22:13:12 -0700 (PDT) Date: Thu, 9 May 2024 22:13:09 -0700 Message-Id: <20240510051309.2452468-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.0.118.g7fe29c98d7-goog Subject: [PATCH v1] perf stat: Don't display metric header for non-leader uncore events From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , K Prateek Nayak , Yicong Yang , Kaige Ye , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On an Intel tigerlake laptop a metric like: ``` { "BriefDescription": "Test", "MetricExpr": "imc_free_running@data_read@ + imc_free_running@data_write@", "MetricGroup": "Test", "MetricName": "Test", "ScaleUnit": "6.103515625e-5MiB" }, ``` Will have 4 events: uncore_imc_free_running_0/data_read/ uncore_imc_free_running_0/data_write/ uncore_imc_free_running_1/data_read/ uncore_imc_free_running_1/data_write/ If aggregration is disabled with metric-only 2 column headers are needed: ``` $ perf stat -M test --metric-only -A -a sleep 1 Performance counter stats for 'system wide': MiB Test MiB Test CPU0 1821.0 1820.5 ``` But when not, the counts aggregated in the metric leader and only 1 column should be shown: ``` $ perf stat -M test --metric-only -a sleep 1 Performance counter stats for 'system wide': MiB Test 5909.4 1.001258915 seconds time elapsed ``` Achieve this by skipping events that aren't metric leaders when printing column headers and aggregation isn't disabled. The bug is long standing, the fixes tag is set to a refactor as that is as far back as is reasonable to backport. Fixes: 088519f318be ("perf stat: Move the display functions to stat-display.c") Signed-off-by: Ian Rogers --- tools/perf/util/stat-display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index ea11e3437444..bb6bbb821b5a 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -1251,6 +1251,9 @@ static void print_metric_headers(struct perf_stat_config *config, /* Print metrics headers only */ evlist__for_each_entry(evlist, counter) { + if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter) + continue; + os.evsel = counter; perf_stat__print_shadow_stats(config, counter, 0, -- 2.45.0.118.g7fe29c98d7-goog