From patchwork Thu Aug 22 13:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13773398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BB04C3DA4A for ; Thu, 22 Aug 2024 13:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=nVYh6l0wdwh6RU0hHASQqUlGh5BLnQN3l8zIGGlWmvE=; b=A1ZOus+MwBHcdHAsTHmlrXDAyR i44gZ9rhFTEkwBPjfZE189F+s/RDzTPJkhnGZi+Z4m/6yT3sPUldsp/tijltstODEdAkJTK501xlQ jkFlUDeKixA0/mCtVUUb7dZOoX80V542/tXWm/9NdwT6+VSIPJqXnCcOm4zH+eDGkVRAExf4KhGdK v9fiF79HuiZdAGxbrncq4fCXR+CJaAQmo7MZSpC666HXwhz6snUrnON54D3JbPgjMJYe0JZqNjo+J TrEHSqunRy45ivLGET6tXutY6ctd416EhRSpUHnGIRmCPd3Zzmo/fXHW1PlGv5dmLj6Tc956XLs8b AYnzgfxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7qe-0000000Cw2w-3BoA; Thu, 22 Aug 2024 13:27:33 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7p3-0000000CvSa-2YUp for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2024 13:25:55 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-53346132365so1049826e87.1 for ; Thu, 22 Aug 2024 06:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724333151; x=1724937951; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nVYh6l0wdwh6RU0hHASQqUlGh5BLnQN3l8zIGGlWmvE=; b=y6STDb3NJfLAZg2wIZ8hILDPvYqoLP5PnxNj7TYUkLv6MQEfzWWuJ0IZAMeN0OQBFD Op+se4QiHyCDzMS1gGoNhNPL7FKgT2AnAPCzea3Uuek9if93+x7FJ1nHX3UV2MJ6N/Ik LKoCmk+KuxkOcxR2+ufaNa/KsVd1/SsxTbOkLB6NowwX/zslyaS1n5lngmxu9deOOCjb kV6UmMTLafQwIbK+1hxENmjs31gEspqX+/brneEwKFAbq/NIbq+VoGM08/J+/CRF+HUZ 2lEu+1CiGO54gWaWMxXDt2Ey9FAb5eJ0Jg3stRJ30QDzYRff7oWZ7E4jdHLpzscP86Zy iP0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724333151; x=1724937951; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nVYh6l0wdwh6RU0hHASQqUlGh5BLnQN3l8zIGGlWmvE=; b=vQ+Qo4DaZykVCkzGuKhBQZGirN8HCQVkJqSlLKddNOTAD0qhRRTNvOhtUVkAWzf1gJ H8DyjaPP0/aXMH/Noe+X4WPPcIpAAU+Mw8huxeYI8wZsuUJnAdZSdNcKLu57SCz8jNlv raDBP17xxr+NNMZhUtL0IkfQ/Xv3uXNEdvXB1PYuWWMGrtWXxer7/QxKM7uMTMQtDkaX WqJOL1bL3x1+WvE4nPjysweUQotKI4mbwJTmZHSaa2xr2lS+2pmPCwtUFkRS2b2OCAq1 LBCt9AiiAYDaHWzBngnSItME8AU82eFigy9SFCtVrxTskynNjdrq6Ew+GyxFWNyD8Hqx /eZw== X-Forwarded-Encrypted: i=1; AJvYcCVKmX6H5/LPmknxaSKFLTCf7AwUikZ+Vjf3Bpc+VUVHvj8/kteyCCtvYx7BfWbAqr2cuU+30pwn4MDljBgTSl/6@lists.infradead.org X-Gm-Message-State: AOJu0YyzjRPn2npdTXd88xxxz14OaaBBszJasRvUco434Q6mjx16dcJr l86o6+zWTUeywRz02uiKwEw/M/Ia4eEAwxvqnWaB5HssJRQTBwuDKATuzYdtPPI= X-Google-Smtp-Source: AGHT+IH2Hd5EohQNNHspV0Khzu+ugfgzCqg56GLkuDMisgMowNXBzMTMw7aZSsvqqFnpdN2jHChd0Q== X-Received: by 2002:a05:6512:a90:b0:533:e83:c414 with SMTP id 2adb3069b0e04-533486085e4mr3547532e87.59.1724333150265; Thu, 22 Aug 2024 06:25:50 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f4365a9sm119497766b.125.2024.08.22.06.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:25:49 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org Cc: James Clark , John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Weilin Wang , Athira Rajeev , Dominique Martinet , Yang Jihong , Colin Ian King , Andi Kleen , Ze Gao , Jing Zhang , Sun Haiyong , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/7] Event parsing fixes Date: Thu, 22 Aug 2024 14:24:44 +0100 Message-Id: <20240822132506.1468090-1-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_062553_675400_61B231EC X-CRM114-Status: GOOD ( 17.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I rebased this one and made some other fixes so that I could test it, so I thought I'd repost it here in case it's helpful. I also added a new test. But for the testing it all looks ok. There is one small difference where it now shows "stalled-cycles-..." as events, when before it just didn't show them at all when they weren't supported: $ perf stat -- true Performance counter stats for 'true': 0.66 msec task-clock # 0.384 CPUs utilized 0 context-switches # 0.000 /sec 0 cpu-migrations # 0.000 /sec 52 page-faults # 78.999 K/sec cpu_atom/instructions/ (0.00%) 978,399 cpu_core/instructions/ # 1.02 insn per cycle cpu_atom/cycles/ (0.00%) 959,722 cpu_core/cycles/ # 1.458 GHz cpu_atom/stalled-cycles-frontend/ cpu_core/stalled-cycles-frontend/ I don't think that's a big deal though and could probably be fixed up later if we really want to. Tested on Raptor Lake, Juno, N1, Ampere (with the DSU cycles PMU) and I also faked an Apple M on Juno. Changes since v3: * Rebase onto perf-tools-next 6236ebe07 * Fix Intel TPEBS counting mode test * Fix arm-spe build * Add support for DT devices in stat test * Add a new test for hybrid perf stat default arguments Ian Rogers (5): perf evsel: Add alternate_hw_config and use in evsel__match perf stat: Uniquify event name improvements perf stat: Remove evlist__add_default_attrs use strings perf evsel x86: Make evsel__has_perf_metrics work for legacy events perf evsel: Remove pmu_name James Clark (2): perf test: Make stat test work on DT devices perf test: Add a test for default perf stat command tools/perf/arch/arm64/util/arm-spe.c | 4 +- tools/perf/arch/x86/util/evlist.c | 74 +---- tools/perf/arch/x86/util/evsel.c | 35 ++- tools/perf/builtin-diff.c | 6 +- tools/perf/builtin-stat.c | 291 +++++++----------- tools/perf/tests/parse-events.c | 2 +- tools/perf/tests/shell/stat.sh | 33 +- .../perf/tests/shell/test_stat_intel_tpebs.sh | 11 +- tools/perf/util/evlist.c | 46 +-- tools/perf/util/evlist.h | 12 - tools/perf/util/evsel.c | 28 +- tools/perf/util/evsel.h | 22 +- tools/perf/util/metricgroup.c | 4 +- tools/perf/util/parse-events.c | 58 ++-- tools/perf/util/parse-events.h | 8 +- tools/perf/util/parse-events.y | 2 +- tools/perf/util/pmu.c | 6 +- tools/perf/util/pmu.h | 2 +- tools/perf/util/stat-display.c | 101 ++++-- tools/perf/util/stat-shadow.c | 14 +- tools/perf/util/stat.c | 2 +- 21 files changed, 348 insertions(+), 413 deletions(-)