linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf test: Speed up test case 70 annotate basic tests
@ 2024-06-07  5:43 Thomas Richter
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Richter @ 2024-06-07  5:43 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, amhyung
  Cc: svens, gor, sumanthk, hca, Thomas Richter

On some s390 linux machine (mostly older models) and with debug
packages installed, the test case 'perf annotate basic tests' runs
for some longer time.
Speed up the test and save the output of command perf annotate
in a temporary file. This is used to perform pattern matching via
grep command. This saves on invocation of perf annotate which
runs for some time.

Output before:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   4m35.543s
 user   3m19.442s
 sys    1m14.322s
 EXIT CODE 0
 #
Output after:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   2m2.881s
 user   1m30.980s
 sys    0m30.684s
 EXIT CODE 0
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/shell/annotate.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
index 1db1e8113d99..b072d9b97387 100755
--- a/tools/perf/tests/shell/annotate.sh
+++ b/tools/perf/tests/shell/annotate.sh
@@ -15,12 +15,13 @@ skip_test_missing_symbol ${testsym}
 
 err=0
 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
 testprog="perf test -w noploop"
 # disassembly format: "percent : offset: instruction (operands ...)"
 disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"
 
 cleanup() {
-  rm -rf "${perfdata}"
+  rm -rf "${perfdata}" "${perfout}"
   rm -rf "${perfdata}".old
 
   trap - EXIT TERM INT
@@ -41,8 +42,11 @@ test_basic() {
     return
   fi
 
+  # Generate the annotated output file
+  perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
+
   # check if it has the target symbol
-  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${testsym}"
+  if ! grep "${testsym}" "${perfout}"
   then
     echo "Basic annotate [Failed: missing target symbol]"
     err=1
@@ -50,7 +54,7 @@ test_basic() {
   fi
 
   # check if it has the disassembly lines
-  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${disasm_regex}"
+  if ! grep "${disasm_regex}" "${perfout}"
   then
     echo "Basic annotate [Failed: missing disasm output from default disassembler]"
     err=1
-- 
2.45.1


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

* [PATCH] perf test: Speed up test case 70 annotate basic tests
@ 2024-06-07  5:43 Thomas Richter
  2024-06-07 20:05 ` Namhyung Kim
  2024-06-09  2:34 ` Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Richter @ 2024-06-07  5:43 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, namhyung
  Cc: svens, gor, sumanthk, hca, Thomas Richter

On some s390 linux machine (mostly older models) and with debug
packages installed, the test case 'perf annotate basic tests' runs
for some longer time.
Speed up the test and save the output of command perf annotate
in a temporary file. This is used to perform pattern matching via
grep command. This saves on invocation of perf annotate which
runs for some time.

Output before:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   4m35.543s
 user   3m19.442s
 sys    1m14.322s
 EXIT CODE 0
 #
Output after:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   2m2.881s
 user   1m30.980s
 sys    0m30.684s
 EXIT CODE 0
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/shell/annotate.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
index 1db1e8113d99..b072d9b97387 100755
--- a/tools/perf/tests/shell/annotate.sh
+++ b/tools/perf/tests/shell/annotate.sh
@@ -15,12 +15,13 @@ skip_test_missing_symbol ${testsym}
 
 err=0
 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
 testprog="perf test -w noploop"
 # disassembly format: "percent : offset: instruction (operands ...)"
 disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"
 
 cleanup() {
-  rm -rf "${perfdata}"
+  rm -rf "${perfdata}" "${perfout}"
   rm -rf "${perfdata}".old
 
   trap - EXIT TERM INT
@@ -41,8 +42,11 @@ test_basic() {
     return
   fi
 
+  # Generate the annotated output file
+  perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
+
   # check if it has the target symbol
-  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${testsym}"
+  if ! grep "${testsym}" "${perfout}"
   then
     echo "Basic annotate [Failed: missing target symbol]"
     err=1
@@ -50,7 +54,7 @@ test_basic() {
   fi
 
   # check if it has the disassembly lines
-  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${disasm_regex}"
+  if ! grep "${disasm_regex}" "${perfout}"
   then
     echo "Basic annotate [Failed: missing disasm output from default disassembler]"
     err=1
-- 
2.45.1


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

* Re: [PATCH] perf test: Speed up test case 70 annotate basic tests
  2024-06-07  5:43 [PATCH] perf test: Speed up test case 70 annotate basic tests Thomas Richter
@ 2024-06-07 20:05 ` Namhyung Kim
  2024-06-09  2:34 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-06-07 20:05 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, acme, svens, gor, sumanthk, hca

On Fri, Jun 07, 2024 at 07:43:52AM +0200, Thomas Richter wrote:
> On some s390 linux machine (mostly older models) and with debug
> packages installed, the test case 'perf annotate basic tests' runs
> for some longer time.
> Speed up the test and save the output of command perf annotate
> in a temporary file. This is used to perform pattern matching via
> grep command. This saves on invocation of perf annotate which
> runs for some time.
> 
> Output before:
>  # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?
> 
>  real   4m35.543s
>  user   3m19.442s
>  sys    1m14.322s
>  EXIT CODE 0
>  #
> Output after:
>  # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?
> 
>  real   2m2.881s
>  user   1m30.980s
>  sys    0m30.684s
>  EXIT CODE 0
>  #

Oh.. it takes too long.  I think we should limit the output from
perf annotate in some way.  Anyway, the patch looks ok.

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

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
>  tools/perf/tests/shell/annotate.sh | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
> index 1db1e8113d99..b072d9b97387 100755
> --- a/tools/perf/tests/shell/annotate.sh
> +++ b/tools/perf/tests/shell/annotate.sh
> @@ -15,12 +15,13 @@ skip_test_missing_symbol ${testsym}
>  
>  err=0
>  perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> +perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
>  testprog="perf test -w noploop"
>  # disassembly format: "percent : offset: instruction (operands ...)"
>  disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"
>  
>  cleanup() {
> -  rm -rf "${perfdata}"
> +  rm -rf "${perfdata}" "${perfout}"
>    rm -rf "${perfdata}".old
>  
>    trap - EXIT TERM INT
> @@ -41,8 +42,11 @@ test_basic() {
>      return
>    fi
>  
> +  # Generate the annotated output file
> +  perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
> +
>    # check if it has the target symbol
> -  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${testsym}"
> +  if ! grep "${testsym}" "${perfout}"
>    then
>      echo "Basic annotate [Failed: missing target symbol]"
>      err=1
> @@ -50,7 +54,7 @@ test_basic() {
>    fi
>  
>    # check if it has the disassembly lines
> -  if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${disasm_regex}"
> +  if ! grep "${disasm_regex}" "${perfout}"
>    then
>      echo "Basic annotate [Failed: missing disasm output from default disassembler]"
>      err=1
> -- 
> 2.45.1
> 

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

* Re: [PATCH] perf test: Speed up test case 70 annotate basic tests
  2024-06-07  5:43 [PATCH] perf test: Speed up test case 70 annotate basic tests Thomas Richter
  2024-06-07 20:05 ` Namhyung Kim
@ 2024-06-09  2:34 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-06-09  2:34 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, Thomas Richter
  Cc: svens, gor, sumanthk, hca

On Fri, 07 Jun 2024 07:43:52 +0200, Thomas Richter wrote:

> On some s390 linux machine (mostly older models) and with debug
> packages installed, the test case 'perf annotate basic tests' runs
> for some longer time.
> Speed up the test and save the output of command perf annotate
> in a temporary file. This is used to perform pattern matching via
> grep command. This saves on invocation of perf annotate which
> runs for some time.
> 
> [...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung

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

end of thread, other threads:[~2024-06-09  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07  5:43 [PATCH] perf test: Speed up test case 70 annotate basic tests Thomas Richter
2024-06-07 20:05 ` Namhyung Kim
2024-06-09  2:34 ` Namhyung Kim
  -- strict thread matches above, loose matches on Subject: below --
2024-06-07  5:43 Thomas Richter

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).