Message ID | 20231107184020.1497571-1-kan.liang@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp434238vqo; Tue, 7 Nov 2023 10:41:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrgEjgqr3uq5obDXxKvYnQTHJLGz+y/mOeu6dpfQA39zGdYMljRRze09EoKrLVB4PL+vjp X-Received: by 2002:a05:6e02:1e07:b0:359:4287:2905 with SMTP id g7-20020a056e021e0700b0035942872905mr4726542ila.25.1699382467360; Tue, 07 Nov 2023 10:41:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699382467; cv=none; d=google.com; s=arc-20160816; b=JfaYtTHnbeav02XwNnm+rf5Iv7hYwd6xvUgOAlJEhFGC2Zh7qbQ81v8KoHgy5PHXWt jFPNyQ25ipcTyCm3BT8yG+seljRHHycCQr9oWp557qqVRBcg6PPtmsuWaMD6WkwK6Fx/ 4bVYwGvrangwQPJehgy/JXvnqc1NvXcv10/x8upaKa9SQLgLSeZHHqQBBctwTOdmHf1L sMaicpbuzJTNfyGxvwccQtXXpWeXgOf6U+qNABGWsCdkdpjqPTQiOAgKbq3V7QTebBAR k9u+DxOspa9VSxRZPXsODrAY/kx7qoxEphyQiuYAmvPCWqYi4KX+eEA8xAwU8A+8dZv+ 1OZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Xbhs1UQk8+BLrzs15+egnU8hm1QGmlwMrIKJnNVS2mI=; fh=XESocjTH1UvQGryUR/ShQ0tppVSp72e0RCZuf7dmCo8=; b=TP4bNdK6seHzyi/RSk8DvC/F8lHdD1D+CAxkXGt2bY8q5Lzp6rvJT0FEYwe+oCbJ15 CkyXZaAFQa9v47KfSO3XBZkVGjifOvMSiJkGYByVv6N4/iD3VNMVxEnCvVX7ebeVTzhq 9tNvP1ineKdiR04RncAU4Y+jhozuxqErijwDhs0q9o3on4VFhdOL+gxu4Dy9lfV5LoQ6 YNlsLXKomT20wPL15Tye3Or30mz7WRDa6F+ulTXYkXrIQfAa3RlW+udakFbN1WKsEuAZ r2BvmeMhgP5o75Xsfa8Sydamt2TWJ5Xn/WynQ1KFWQ8GDsDWzy7kpT3JP6VE4IbjEInk 6IsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jdj2mgk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id r73-20020a632b4c000000b005b99bfe3301si2822112pgr.462.2023.11.07.10.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 10:41:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jdj2mgk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DF41B80873A9; Tue, 7 Nov 2023 10:40:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjKGSk0 (ORCPT <rfc822;lhua1029@gmail.com> + 32 others); Tue, 7 Nov 2023 13:40:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjKGSkZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 7 Nov 2023 13:40:25 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA6F12B; Tue, 7 Nov 2023 10:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699382423; x=1730918423; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=K0VNtu18XupFGGixMLkWpky1YTjIXhLMqucmTQYHaMs=; b=jdj2mgk4hnFPhYu+iFSFsJQrNf5JPn0tgUzOf4YQjtkBSPi5ZAegeDrW iwvdRfXcTZJYLK2bEq0dDISoBespVN58lrpxWZJtL2iA/pBemD31GWS3O gsye/0x1bLEUbk12H6FbleRhxAoauKXHJbRagtlh1gXNBl7Afgf1+9ULW 4thDt03ZDL4HDkJEW4w0SmUedpQG9ENjveOltNeUVFIK+eAUQ7iBytlJY lhAbkpD+TCeqBpJZMUJPKQNRYlM0McFL+4IQ70g2O43c0Br92GPF1q39j +jUTHKk8Y+aLkioC+L6YlIZWl0GZ6HsrrqPphnOrek1SUNVKsq+eldRBw g==; X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="368925010" X-IronPort-AV: E=Sophos;i="6.03,284,1694761200"; d="scan'208";a="368925010" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2023 10:40:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="739227341" X-IronPort-AV: E=Sophos;i="6.03,284,1694761200"; d="scan'208";a="739227341" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga006.jf.intel.com with ESMTP; 07 Nov 2023 10:40:22 -0800 From: kan.liang@linux.intel.com To: acme@kernel.org, irogers@google.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com, jolsa@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, tinghao.zhang@intel.com, Kan Liang <kan.liang@linux.intel.com> Subject: [PATCH V2] perf test: Basic branch counter support Date: Tue, 7 Nov 2023 10:40:20 -0800 Message-Id: <20231107184020.1497571-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 07 Nov 2023 10:40:42 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781928096356208297 X-GMAIL-MSGID: 1781931670278871306 |
Series |
[V2] perf test: Basic branch counter support
|
|
Commit Message
Liang, Kan
Nov. 7, 2023, 6:40 p.m. UTC
From: Kan Liang <kan.liang@linux.intel.com> Add a basic test for the branch counter feature. The test verifies that - The new filter can be successfully applied on the supported platforms. - The counter value can be outputted via the perf report -D Signed-off-by: Kan Liang <kan.liang@linux.intel.com> --- Changes since V2: - Update the output msg for the skipped case (Ian) tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
Comments
Hi Ian, On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote: > From: Kan Liang <kan.liang@linux.intel.com> > > Add a basic test for the branch counter feature. > > The test verifies that > - The new filter can be successfully applied on the supported platforms. > - The counter value can be outputted via the perf report -D > > Signed-off-by: Kan Liang <kan.liang@linux.intel.com> > --- > > Changes since V2: > - Update the output msg for the skipped case (Ian) > Any comments for this patch? Thanks, Kan > tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh > index 4fbc74805d52..cc207a16ae24 100755 > --- a/tools/perf/tests/shell/record.sh > +++ b/tools/perf/tests/shell/record.sh > @@ -11,6 +11,9 @@ err=0 > perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) > testprog="perf test -w thloop" > testsym="test_loop" > +cpu_pmu_dir="/sys/bus/event_source/devices/cpu*" > +br_cntr_file="/caps/branch_counter_nr" > +br_cntr_output="branch stack counters" > > cleanup() { > rm -rf "${perfdata}" > @@ -154,10 +157,37 @@ test_workload() { > echo "Basic target workload test [Success]" > } > > +test_branch_counter() { > + echo "Basic branch counter test" > + # Check if the branch counter feature is supported > + for dir in $cpu_pmu_dir > + do > + if [ ! -e "$dir$br_cntr_file" ] > + then > + echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]" > + return > + fi > + done > + if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null > + then > + echo "Basic branch counter test [Failed record]" > + err=1 > + return > + fi > + if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output" > + then > + echo "Basic branch record test [Failed missing output]" > + err=1 > + return > + fi > + echo "Basic branch counter test [Success]" > +} > + > test_per_thread > test_register_capture > test_system_wide > test_workload > +test_branch_counter > > cleanup > exit $err
On Mon, Nov 13, 2023 at 8:12 AM Liang, Kan <kan.liang@linux.intel.com> wrote: > > Hi Ian, > > On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote: > > From: Kan Liang <kan.liang@linux.intel.com> > > > > Add a basic test for the branch counter feature. > > > > The test verifies that > > - The new filter can be successfully applied on the supported platforms. > > - The counter value can be outputted via the perf report -D > > > > Signed-off-by: Kan Liang <kan.liang@linux.intel.com> > > --- > > > > Changes since V2: > > - Update the output msg for the skipped case (Ian) > > > > Any comments for this patch? Confirmed the wildcard works as expected. Tested-by: Ian Rogers <irogers@google.com> Thanks, Ian > Thanks, > Kan > > > tools/perf/tests/shell/record.sh | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh > > index 4fbc74805d52..cc207a16ae24 100755 > > --- a/tools/perf/tests/shell/record.sh > > +++ b/tools/perf/tests/shell/record.sh > > @@ -11,6 +11,9 @@ err=0 > > perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) > > testprog="perf test -w thloop" > > testsym="test_loop" > > +cpu_pmu_dir="/sys/bus/event_source/devices/cpu*" > > +br_cntr_file="/caps/branch_counter_nr" > > +br_cntr_output="branch stack counters" > > > > cleanup() { > > rm -rf "${perfdata}" > > @@ -154,10 +157,37 @@ test_workload() { > > echo "Basic target workload test [Success]" > > } > > > > +test_branch_counter() { > > + echo "Basic branch counter test" > > + # Check if the branch counter feature is supported > > + for dir in $cpu_pmu_dir > > + do > > + if [ ! -e "$dir$br_cntr_file" ] > > + then > > + echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]" > > + return > > + fi > > + done > > + if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null > > + then > > + echo "Basic branch counter test [Failed record]" > > + err=1 > > + return > > + fi > > + if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output" > > + then > > + echo "Basic branch record test [Failed missing output]" > > + err=1 > > + return > > + fi > > + echo "Basic branch counter test [Success]" > > +} > > + > > test_per_thread > > test_register_capture > > test_system_wide > > test_workload > > +test_branch_counter > > > > cleanup > > exit $err
Em Mon, Nov 20, 2023 at 04:22:24PM -0800, Ian Rogers escreveu: > On Mon, Nov 13, 2023 at 8:12 AM Liang, Kan <kan.liang@linux.intel.com> wrote: > > On 2023-11-07 1:40 p.m., kan.liang@linux.intel.com wrote: > > > From: Kan Liang <kan.liang@linux.intel.com> > > > Add a basic test for the branch counter feature. > > > The test verifies that > > > - The new filter can be successfully applied on the supported platforms. > > > - The counter value can be outputted via the perf report -D > > > Signed-off-by: Kan Liang <kan.liang@linux.intel.com> > > Any comments for this patch? > Confirmed the wildcard works as expected. > Tested-by: Ian Rogers <irogers@google.com> Thanks, applied to perf-tools-next. - Arnaldo
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 4fbc74805d52..cc207a16ae24 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -11,6 +11,9 @@ err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) testprog="perf test -w thloop" testsym="test_loop" +cpu_pmu_dir="/sys/bus/event_source/devices/cpu*" +br_cntr_file="/caps/branch_counter_nr" +br_cntr_output="branch stack counters" cleanup() { rm -rf "${perfdata}" @@ -154,10 +157,37 @@ test_workload() { echo "Basic target workload test [Success]" } +test_branch_counter() { + echo "Basic branch counter test" + # Check if the branch counter feature is supported + for dir in $cpu_pmu_dir + do + if [ ! -e "$dir$br_cntr_file" ] + then + echo "branch counter feature not supported on all core PMUs ($dir) [Skipped]" + return + fi + done + if ! perf record -o "${perfdata}" -j any,counter ${testprog} 2> /dev/null + then + echo "Basic branch counter test [Failed record]" + err=1 + return + fi + if ! perf report -i "${perfdata}" -D -q | grep -q "$br_cntr_output" + then + echo "Basic branch record test [Failed missing output]" + err=1 + return + fi + echo "Basic branch counter test [Success]" +} + test_per_thread test_register_capture test_system_wide test_workload +test_branch_counter cleanup exit $err