Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp383156rwr; Wed, 26 Apr 2023 00:12:39 -0700 (PDT) X-Google-Smtp-Source: AKy350bd+ufnxScGJr+alPIUTYhd3UIeJ2Ah93vzJEU6bsWd16NJOx/Ypmgb4OMMls8du0SOjtZa X-Received: by 2002:a05:6a20:748c:b0:f0:fa9b:d4c7 with SMTP id p12-20020a056a20748c00b000f0fa9bd4c7mr25329989pzd.55.1682493159150; Wed, 26 Apr 2023 00:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682493159; cv=none; d=google.com; s=arc-20160816; b=kZ2rYjnVunwQAA5054ZaPuHN/WBgqphao0BsD9Ci2lySN2cQzzU9NVInKtVrRCWKwJ 3qIW6qiJPIV2S3h9Be1xgOL5B05RSZwjlmULbc8W0p9EyRXaq9RukneBqub38NfAU9zd AMcxq1gOmLi7+2uybrWHOKJiHuCi66gyh88jgCQQsKDbiHFyCL/i1uW2ln4PeToFF4Ko qUXhXzX3S/jxDNYYNfE9Rzjkir/qgBJUaMa36Id/OW50Oy4gvNMB+rOEAsrvQijNfVJZ LnCmtmwQrh7s87vkvTO6D1t6df4tq3/hx48137Yb2JKbO9vTW+75ryh0aUhlj1i38iIi dEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=uX2HSmx6kEz7AF/sikU4sT7+5OfRWtA69N2zyZbBkbM=; b=z5QZtFJMfjyDVu8tmx/8hKDQfDCP1OCRY+V8zoPMrJt3XJrUwRMRWkzgOF8PML/GXS ZpCvteJ/ehWMMRGucFj0laWpSW35Vk0L2qfCXeNhew2PzYdIFCJGi9gpUYK6huvpgUAU +UfHZqsWuTw1lfCJz43zRIw4Of2P6wxEmIwvaRycPzzw0gd0cjr5Af9aoStu3z+Wqwa9 O4AUypZQ6XfCpY9Wp/i3G/gWMOHw+i30mFxiJoh7RW+TTua5FvwIuS5DbzU/HWcDxpbR 1fwKNdUSXQubKEDkmXVLjv6OOAZN1kCJxKBpgz0YPnaTCMTxCy81A1Yve6vSR38jt/yS LqYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=V1kfrshm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a634304000000b00524b2358ffcsi15516281pga.574.2023.04.26.00.12.26; Wed, 26 Apr 2023 00:12:39 -0700 (PDT) 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=@google.com header.s=20221208 header.b=V1kfrshm; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239929AbjDZHHM (ORCPT + 99 others); Wed, 26 Apr 2023 03:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239855AbjDZHGX (ORCPT ); Wed, 26 Apr 2023 03:06:23 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B2149DB for ; Wed, 26 Apr 2023 00:05:14 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b96ee51ee20so7375513276.3 for ; Wed, 26 Apr 2023 00:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682492696; x=1685084696; 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=V1kfrshmykyBp8yMvqUrIcFCsLJN7oX2qRAw/M9JFjIhK7wu20XfksXvAdE+VvKrx6 LZ/YkK0XAw86N7XPrpWITnpiAKwmVOhILAk2awui/pJZnWiHPN8TdhC8qbY07XK1t1cY DvRbN2h9wK3x26IHAiyjE9Ad2qjJGkBVWuGFFdBGEW35zbaFocxZVLw9ckE5I0h6qgub 08dpRAxkDl4+5B750jbONX2nAT0O5+j8zQbITF+DzEqpNqC5cXts9sH7XD4T0yvT3YV4 W/hINe5iywkAi+y/BQ9FqlvR4kAPirzwHItTIiKwzFhJj3JlulMKA00F/ShcEcawlmcG apQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682492696; x=1685084696; 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=IirdxjsfttKPeIMXy5YTlEG3bPdc0jWtxTwUhNek00OQJj1Mb0DSgXEZGHSg5V993S V0CaIODqEC0L5eSFzSyCbmSdBeHwqMauoGH3O8LD+VpjmV9kR/IXleDHP3XetyEzDPE8 ztuhbbQKUz1BPfkQiCef5esA2YtUJMEHjSoavq341+dBcHUhe64QIwbq7WOqcq34s3/D 1xGs0cmv6LPoeiA8eZLkgiRAVqKfcg9WeN8qGRvL2IlJtBJV/AtSQvMrzLnK+Pur6Ahi T3ymPpjESav1MMYREIXudhIbai0YdqlvwSaagihE7C8gRv3d2BfE/y1SkhEMB2cs9/iF SUcw== X-Gm-Message-State: AAQBX9ctT75fG+xGo75he3aZsMLjeLJvtFn34aMfsHbLiRkwPogGhCML Ay0Ax/2/qiBZ7dJZsyKhUR8aoZ20H/i4 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:144f:e890:2b29:48d9]) (user=irogers job=sendgmr) by 2002:a05:690c:70c:b0:54e:8b9a:65be with SMTP id bs12-20020a05690c070c00b0054e8b9a65bemr9617364ywb.6.1682492696589; Wed, 26 Apr 2023 00:04:56 -0700 (PDT) Date: Wed, 26 Apr 2023 00:00:38 -0700 In-Reply-To: <20230426070050.1315519-1-irogers@google.com> Message-Id: <20230426070050.1315519-29-irogers@google.com> Mime-Version: 1.0 References: <20230426070050.1315519-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Subject: [PATCH v1 28/40] 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 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]" } +test_cputype() { + # Test --cputype argument. + echo "cputype test" + + # Bogus PMU should fail. + if perf stat --cputype="123" -e instructions true > /dev/null 2>&1 + then + echo "cputype test [Bogus PMU didn't fail]" + err=1 + return + fi + + # Find a known PMU for cputype. + pmu="" + for i in cpu cpu_atom armv8_pmuv3_0 + do + if test -d "/sys/devices/$i" + then + pmu="$i" + break + fi + if perf stat -e "$i/instructions/" true > /dev/null 2>&1 + then + pmu="$i" + break + fi + done + if test "x$pmu" = "x" + then + echo "cputype test [Skipped known PMU not found]" + return + fi + + # Test running with cputype produces output. + if ! perf stat --cputype="$pmu" -e instructions true 2>&1 | grep -E -q "instructions" + then + echo "cputype test [Failed count missed with given filter]" + err=1 + 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 -- 2.40.1.495.gc816e09b53d-goog