From nobody Fri Dec 19 20:15:30 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39E74C7618E for ; Sat, 29 Apr 2023 05:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347442AbjD2Flg (ORCPT ); Sat, 29 Apr 2023 01:41:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347398AbjD2Fl1 (ORCPT ); Sat, 29 Apr 2023 01:41:27 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D46144C10 for ; Fri, 28 Apr 2023 22:41:01 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-b9a776a5eb2so1227726276.0 for ; Fri, 28 Apr 2023 22:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682746796; x=1685338796; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uX2HSmx6kEz7AF/sikU4sT7+5OfRWtA69N2zyZbBkbM=; b=Be74dFkeae+6OHSEu/03XKrBVxNymfcbSYVyb/ZX2hSWfFcIJgwBDrpgO8cfOCw7Yp PJazyE006HUDoCTOUkOUgs7bhFI+Yl8tFfEBPYT3VG5wfFgH+lymAEWwboqfszWdrlev I7PV0mvHD/prllgC5Pkg3TTFFuk8ee9ftAkMrmJds//Lu6qio0XrpaImKWd71wKG5RBE FvDJwnLRo/qfz3DnxE18Ir2ts/W6eDPL1EVxtUecyZl6KN0Fae+W8bVTs6nr8jciuHKM mQmHfypx17SxfmMnnH7q2LbtEgZtUzUO8V+hrdvRT26fD/JSg90+aBlYDR9ixqdo7Iye 5/Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682746796; x=1685338796; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uX2HSmx6kEz7AF/sikU4sT7+5OfRWtA69N2zyZbBkbM=; b=FDN1gvtl3eNk+D2yKUmWPqSk+cFc1IQPunwBSspdxIxDFGJZxnu0tPmc4ehQ89jqx9 xh029KmhFU2mbBj+bwNJpT8fcsbL24cI/MGb07GqIkSJhSlqKSiO/+pDWe8wVwMDzUfc LSbJdp2WPSrZ4HfxSslvSvEq54ipdyJgLwGF9e+TbSUOB5so5ArD8byw7dLVyMSVVd32 2tudlAUvo3NHze/9Uwqj2NPJY8zBBsV5uLWOjnI0t5Fpp+vhEqDPOyWxYWDWahSFfsVi ntBqpIUaniDsLaYAFV2xDzYI5NH7xoo9qRBp+NO1daM5y2Ex433Lp4ofUm/en7121qOt I/Yw== X-Gm-Message-State: AC+VfDxUhcWJNcC31yr5n3QxDDAv/6d7GYrHPLGbf3NyO+flbY1sOzVO SPSYl+iX/TCs+omZreHxt4Of1zfGTK79 X-Google-Smtp-Source: ACHHUZ4Qbw0OscBCzDg+Rk7VlgVWh8m1azLqoOPmHD51gFcezB7KW6l4onfnh5/8nCjmtydjCEfavgBGD8o6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:c563:7e28:fb7c:bce3]) (user=irogers job=sendgmr) by 2002:a25:40c3:0:b0:b9d:8e86:9672 with SMTP id n186-20020a2540c3000000b00b9d8e869672mr469870yba.10.1682746795989; Fri, 28 Apr 2023 22:39:55 -0700 (PDT) Date: Fri, 28 Apr 2023 22:34:53 -0700 In-Reply-To: <20230429053506.1962559-1-irogers@google.com> Message-Id: <20230429053506.1962559-34-irogers@google.com> Mime-Version: 1.0 References: <20230429053506.1962559-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Subject: [PATCH v3 33/46] perf test: Add cputype testing to perf stat From: Ian Rogers To: Arnaldo Carvalho de Melo , Kan Liang , Ahmad Yasin , Peter Zijlstra , Ingo Molnar , Stephane Eranian , Andi Kleen , Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Florian Fischer , Rob Herring , Zhengjun Xing , John Garry , Kajol Jain , Sumanth Korikkar , Thomas Richter , Tiezhu Yang , Ravi Bangoria , Leo Yan , Yang Jihong , James Clark , Suzuki Poulouse , Kang Minchul , Athira Rajeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check a bogus PMU fails and that a known PMU succeeds. Limit to PMUs known cpu, cpu_atom and armv8_pmuv3_0 ones. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/stat.sh | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh index 2c1d3f704995..fe1283ca39d1 100755 --- a/tools/perf/tests/shell/stat.sh +++ b/tools/perf/tests/shell/stat.sh @@ -91,9 +91,53 @@ test_topdown_weak_groups() { echo "Topdown weak groups test [Success]" } =20 +test_cputype() { + # Test --cputype argument. + echo "cputype test" + + # Bogus PMU should fail. + if perf stat --cputype=3D"123" -e instructions true > /dev/null 2>&1 + then + echo "cputype test [Bogus PMU didn't fail]" + err=3D1 + return + fi + + # Find a known PMU for cputype. + pmu=3D"" + for i in cpu cpu_atom armv8_pmuv3_0 + do + if test -d "/sys/devices/$i" + then + pmu=3D"$i" + break + fi + if perf stat -e "$i/instructions/" true > /dev/null 2>&1 + then + pmu=3D"$i" + break + fi + done + if test "x$pmu" =3D "x" + then + echo "cputype test [Skipped known PMU not found]" + return + fi + + # Test running with cputype produces output. + if ! perf stat --cputype=3D"$pmu" -e instructions true 2>&1 | grep -E -q= "instructions" + then + echo "cputype test [Failed count missed with given filter]" + err=3D1 + return + fi + echo "cputype test [Success]" +} + test_default_stat test_stat_record_report test_stat_repeat_weak_groups test_topdown_groups test_topdown_weak_groups +test_cputype exit $err --=20 2.40.1.495.gc816e09b53d-goog