linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output
@ 2025-06-28  1:58 Ian Rogers
  2025-06-30  7:52 ` Thomas Richter
  2025-07-01 17:55 ` Namhyung Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Ian Rogers @ 2025-06-28  1:58 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, James Clark, Thomas Richter,
	linux-perf-users, linux-kernel

The annotate test was sped up by Thomas Richter
<tmricht@linux.ibm.com> in commit
658a8805cb60 ("perf test: Speed up test case 70 annotate basic tests")
by reducing the annotate output using head. This causes flakes on
hybrid machines where the first event dumped may not have the samples
for the test within it. Rather than reduce the output using `head`
switch to `--percent-limit 10` which will stop annotate dumping
functions that have an overhead of less than 10%, the noploop program
should be using more.

Add the missing objdump option for the pipe mode version of the
objdump with a command test.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/shell/annotate.sh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
index 16a1ccd06089..689de58e9238 100755
--- a/tools/perf/tests/shell/annotate.sh
+++ b/tools/perf/tests/shell/annotate.sh
@@ -53,21 +53,22 @@ test_basic() {
   # Generate the annotated output file
   if [ "x${mode}" == "xBasic" ]
   then
-    perf annotate --no-demangle -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
+    perf annotate --no-demangle -i "${perfdata}" --stdio --percent-limit 10 2> /dev/null > "${perfout}"
   else
-    perf annotate --no-demangle -i - --stdio 2> /dev/null < "${perfdata}" > "${perfout}"
+    perf annotate --no-demangle -i - --stdio 2> /dev/null --percent-limit 10 < "${perfdata}" > "${perfout}"
   fi
 
   # check if it has the target symbol
-  if ! head -250 "${perfout}" | grep -q "${testsym}"
+  if ! grep -q "${testsym}" "${perfout}"
   then
     echo "${mode} annotate [Failed: missing target symbol]"
+    cat "${perfout}"
     err=1
     return
   fi
 
   # check if it has the disassembly lines
-  if ! head -250 "${perfout}" | grep -q "${disasm_regex}"
+  if ! grep -q "${disasm_regex}" "${perfout}"
   then
     echo "${mode} annotate [Failed: missing disasm output from default disassembler]"
     err=1
@@ -92,11 +93,11 @@ test_basic() {
   # check one more with external objdump tool (forced by --objdump option)
   if [ "x${mode}" == "xBasic" ]
   then
-    perf annotate --no-demangle -i "${perfdata}" --objdump=objdump 2> /dev/null > "${perfout}"
+    perf annotate --no-demangle -i "${perfdata}" --percent-limit 10 --objdump=objdump 2> /dev/null > "${perfout}"
   else
-    perf annotate --no-demangle -i - "${testsym}" 2> /dev/null < "${perfdata}" > "${perfout}"
+    perf annotate --no-demangle -i - "${testsym}" --percent-limit 10 --objdump=objdump 2> /dev/null < "${perfdata}" > "${perfout}"
   fi
-  if ! head -250 "${perfout}" | grep -q -m 3 "${disasm_regex}"
+  if ! grep -q -m 3 "${disasm_regex}" "${perfout}"
   then
     echo "${mode} annotate [Failed: missing disasm output from non default disassembler (using --objdump)]"
     err=1
-- 
2.50.0.727.gbf7dc18ff4-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output
  2025-06-28  1:58 [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output Ian Rogers
@ 2025-06-30  7:52 ` Thomas Richter
  2025-07-01 17:55 ` Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Richter @ 2025-06-30  7:52 UTC (permalink / raw)
  To: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter, Kan Liang, James Clark, linux-perf-users,
	linux-kernel

On 6/28/25 03:58, Ian Rogers wrote:
> The annotate test was sped up by Thomas Richter
> <tmricht@linux.ibm.com> in commit
> 658a8805cb60 ("perf test: Speed up test case 70 annotate basic tests")
> by reducing the annotate output using head. This causes flakes on
> hybrid machines where the first event dumped may not have the samples
> for the test within it. Rather than reduce the output using `head`
> switch to `--percent-limit 10` which will stop annotate dumping
> functions that have an overhead of less than 10%, the noploop program
> should be using more.
> 
> Add the missing objdump option for the pipe mode version of the
> objdump with a command test.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/tests/shell/annotate.sh | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
> index 16a1ccd06089..689de58e9238 100755
> --- a/tools/perf/tests/shell/annotate.sh
> +++ b/tools/perf/tests/shell/annotate.sh
> @@ -53,21 +53,22 @@ test_basic() {
>    # Generate the annotated output file
>    if [ "x${mode}" == "xBasic" ]
>    then
> -    perf annotate --no-demangle -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
> +    perf annotate --no-demangle -i "${perfdata}" --stdio --percent-limit 10 2> /dev/null > "${perfout}"
>    else
> -    perf annotate --no-demangle -i - --stdio 2> /dev/null < "${perfdata}" > "${perfout}"
> +    perf annotate --no-demangle -i - --stdio 2> /dev/null --percent-limit 10 < "${perfdata}" > "${perfout}"
>    fi
>  
>    # check if it has the target symbol
> -  if ! head -250 "${perfout}" | grep -q "${testsym}"
> +  if ! grep -q "${testsym}" "${perfout}"
>    then
>      echo "${mode} annotate [Failed: missing target symbol]"
> +    cat "${perfout}"
>      err=1
>      return
>    fi
>  
>    # check if it has the disassembly lines
> -  if ! head -250 "${perfout}" | grep -q "${disasm_regex}"
> +  if ! grep -q "${disasm_regex}" "${perfout}"
>    then
>      echo "${mode} annotate [Failed: missing disasm output from default disassembler]"
>      err=1
> @@ -92,11 +93,11 @@ test_basic() {
>    # check one more with external objdump tool (forced by --objdump option)
>    if [ "x${mode}" == "xBasic" ]
>    then
> -    perf annotate --no-demangle -i "${perfdata}" --objdump=objdump 2> /dev/null > "${perfout}"
> +    perf annotate --no-demangle -i "${perfdata}" --percent-limit 10 --objdump=objdump 2> /dev/null > "${perfout}"
>    else
> -    perf annotate --no-demangle -i - "${testsym}" 2> /dev/null < "${perfdata}" > "${perfout}"
> +    perf annotate --no-demangle -i - "${testsym}" --percent-limit 10 --objdump=objdump 2> /dev/null < "${perfdata}" > "${perfout}"
>    fi
> -  if ! head -250 "${perfout}" | grep -q -m 3 "${disasm_regex}"
> +  if ! grep -q -m 3 "${disasm_regex}" "${perfout}"
>    then
>      echo "${mode} annotate [Failed: missing disasm output from non default disassembler (using --objdump)]"
>      err=1
Works ok on s390

Tested-by: Thomas Richter <tmricht@linux.ibm.com>

-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output
  2025-06-28  1:58 [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output Ian Rogers
  2025-06-30  7:52 ` Thomas Richter
@ 2025-07-01 17:55 ` Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-07-01 17:55 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, James Clark, Thomas Richter, linux-perf-users,
	linux-kernel, Ian Rogers

On Fri, 27 Jun 2025 18:58:32 -0700, Ian Rogers wrote:
> The annotate test was sped up by Thomas Richter
> <tmricht@linux.ibm.com> in commit
> 658a8805cb60 ("perf test: Speed up test case 70 annotate basic tests")
> by reducing the annotate output using head. This causes flakes on
> hybrid machines where the first event dumped may not have the samples
> for the test within it. Rather than reduce the output using `head`
> switch to `--percent-limit 10` which will stop annotate dumping
> functions that have an overhead of less than 10%, the noploop program
> should be using more.
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-01 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28  1:58 [PATCH v1] perf test annotate: Use --percent-limit rather than head to reduce output Ian Rogers
2025-06-30  7:52 ` Thomas Richter
2025-07-01 17:55 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).