From: Namhyung Kim <namhyung@kernel.org>
To: Andi Kleen <ak@linux.intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 2/2] Add a test case for perf script -F +metric
Date: Thu, 27 Jun 2024 15:54:43 -0700 [thread overview]
Message-ID: <Zn3ts87B4KEebXUB@google.com> (raw)
In-Reply-To: <20240625004232.1852705-2-ak@linux.intel.com>
On Mon, Jun 24, 2024 at 05:42:32PM -0700, Andi Kleen wrote:
> Just a simple test
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> tools/perf/tests/shell/script.sh | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/shell/script.sh b/tools/perf/tests/shell/script.sh
> index c1a603653662..cd9d41734021 100755
> --- a/tools/perf/tests/shell/script.sh
> +++ b/tools/perf/tests/shell/script.sh
> @@ -1,4 +1,4 @@
> -#!/bin/sh
> +#!/bin/bash
Do we really need this?
> # perf script tests
> # SPDX-License-Identifier: GPL-2.0
>
> @@ -7,6 +7,7 @@ set -e
> temp_dir=$(mktemp -d /tmp/perf-test-script.XXXXXXXXXX)
>
> perfdatafile="${temp_dir}/perf.data"
> +scriptoutput="${temp_dir}/script"
> db_test="${temp_dir}/db_test.py"
>
> err=0
> @@ -88,8 +89,21 @@ test_parallel_perf()
> echo "parallel-perf test [Success]"
> }
>
> +test_metric()
> +{
> + echo "script metric test"
> + if ! perf list | grep -q cycles ; then return ; fi
> + if ! perf list | grep -q instructions ; then return ; fi
> + perf record -e '{cycles,instructions}' -o "${perfdatafile}" bash -c 'for i in `seq 1000` ; do true ; done'
You can use built-in workloads like noploop or so instead of running
an external command.
$ perf record -- perf test -w noploop
Thanks,
Namhyung
> + perf script -i "${perfdatafile}" -F +metric > $scriptoutput
> + test $(grep -c metric $scriptoutput) -gt 5
> + grep metric $scriptoutput | head
> + echo "script metric test [Success]"
> +}
> +
> test_db
> test_parallel_perf
> +test_metric
>
> cleanup
>
> --
> 2.45.2
>
next prev parent reply other threads:[~2024-06-27 22:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 0:42 [PATCH 1/2] perf script: Fix perf script -F +metric Andi Kleen
2024-06-25 0:42 ` [PATCH 2/2] Add a test case for " Andi Kleen
2024-06-27 22:54 ` Namhyung Kim [this message]
2024-06-26 9:09 ` [PATCH 1/2] perf script: Fix " Artem Savkov
2024-06-27 22:50 ` Namhyung Kim
2024-06-28 19:19 ` Andi Kleen
2024-07-01 7:04 ` Artem Savkov
2024-07-01 16:54 ` Andi Kleen
2024-06-27 22:46 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zn3ts87B4KEebXUB@google.com \
--to=namhyung@kernel.org \
--cc=ak@linux.intel.com \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.