From mboxrd@z Thu Jan 1 00:00:00 1970 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 13FCEC7EE22 for ; Mon, 15 May 2023 12:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241791AbjEOMT0 (ORCPT ); Mon, 15 May 2023 08:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241798AbjEOMTW (ORCPT ); Mon, 15 May 2023 08:19:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94065E55; Mon, 15 May 2023 05:19:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30861616F1; Mon, 15 May 2023 12:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62827C433D2; Mon, 15 May 2023 12:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684153159; bh=lJYX593ezg8Jg0Lmvi2e++axev1sq+IYiRfXvVn7TfE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dp27vT5hIoFnezmC0EE7XmNQw06mriBQ1e+F1uQjMr8+D2tdoqAtKoIwku9aQYnQh DrpOfy1wcVDstW8ElQJfxnmWiDEg0/+PZtZ0F/EYQrRcr/2km/N+EbI+z8XZZItC23 l2BQvLkGul8TF6jEJUwaDvPQa8th1kiKQ+Aucyt9lDCGegh3DqcdXa9figbrrF/Ska R7g0ndR6I0o9hQkdSoeutg/VL1WXJIXOx7hCch2U2FHsfJt2i5bQWuZLYZ2jJ9tbY8 cBiyAEgBeKIckR1i8wBBfy3fV98iCZK6d9MgPsZ6KAv6eJWeAyl15DfuXVvC20fP2O faW26bG0d2Qeg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5BB06403B5; Mon, 15 May 2023 09:19:17 -0300 (-03) Date: Mon, 15 May 2023 09:19:17 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: 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 Subject: Re: [PATCH v1] perf test: Add cputype testing to perf stat Message-ID: References: <20230513063447.464691-1-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230513063447.464691-1-irogers@google.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Fri, May 12, 2023 at 11:34:47PM -0700, Ian Rogers escreveu: > Check a bogus PMU fails and that a known PMU succeeds. Limit to PMUs > known cpu, cpu_atom and armv8_pmuv3_0 ones. Thanks, applied. - Arnaldo > 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 b154fbb15d54..3f1e67795490 100755 > --- a/tools/perf/tests/shell/stat.sh > +++ b/tools/perf/tests/shell/stat.sh > @@ -103,10 +103,54 @@ 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_record_script > test_stat_repeat_weak_groups > test_topdown_groups > test_topdown_weak_groups > +test_cputype > exit $err > -- > 2.40.1.606.ga4b1b128d6-goog > -- - Arnaldo