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

perf test 70 takes a long time. One culprit is the output of command
perf annotate. Per default enabled are
 - demangle symbol names
 - interleave source code with assembly code.
Disable demangle of symbols and abort the annotation
after the first 250 lines.

This speeds up the test case considerable, for example
on s390:

Output before:
 # time  perf test 70
 70: perf annotate basic tests             : Ok
 .....
 real   2m7.467s
 user   1m26.869s
 sys    0m34.086s
 #

 Output after:
 # time perf test 70
 70: perf annotate basic tests             : Ok

 real   0m3.341s
 user   0m1.606s
 sys    0m0.362s
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/tests/shell/annotate.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
index b072d9b97387..b28cd95b1d83 100755
--- a/tools/perf/tests/shell/annotate.sh
+++ b/tools/perf/tests/shell/annotate.sh
@@ -43,7 +43,7 @@ test_basic() {
   fi
 
   # Generate the annotated output file
-  perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
+  perf annotate --no-demangle -i "${perfdata}" --stdio 2> /dev/null | head -250 > "${perfout}"
 
   # check if it has the target symbol
   if ! grep "${testsym}" "${perfout}"
@@ -62,8 +62,8 @@ test_basic() {
   fi
 
   # check again with a target symbol name
-  if ! perf annotate -i "${perfdata}" "${testsym}" 2> /dev/null | \
-	  grep -m 3 "${disasm_regex}"
+  if ! perf annotate --no-demangle -i "${perfdata}" "${testsym}" 2> /dev/null | \
+	  head -250 | grep -m 3 "${disasm_regex}"
   then
     echo "Basic annotate [Failed: missing disasm output when specifying the target symbol]"
     err=1
@@ -71,8 +71,8 @@ test_basic() {
   fi
 
   # check one more with external objdump tool (forced by --objdump option)
-  if ! perf annotate -i "${perfdata}" --objdump=objdump 2> /dev/null | \
-	  grep -m 3 "${disasm_regex}"
+  if ! perf annotate --no-demangle -i "${perfdata}" --objdump=objdump 2> /dev/null | \
+	  head -250 | grep -m 3 "${disasm_regex}"
   then
     echo "Basic annotate [Failed: missing disasm output from non default disassembler (using --objdump)]"
     err=1
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] perf/test: Speed up test case perf annotate basic tests
@ 2024-09-17  8:57 Thomas Richter
  2024-09-17 12:51 ` James Clark
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Richter @ 2024-09-17  8:57 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, namhyung
  Cc: agordeev, gor, sumanthk, hca, Thomas Richter

perf test 70 takes a long time. One culprit is the output of command
perf annotate. Per default enabled are
 - demangle symbol names
 - interleave source code with assembly code.
Disable demangle of symbols and abort the annotation
after the first 250 lines.

This speeds up the test case considerable, for example
on s390:

Output before:
 # time  perf test 70
 70: perf annotate basic tests             : Ok
 .....
 real   2m7.467s
 user   1m26.869s
 sys    0m34.086s
 #

 Output after:
 # time perf test 70
 70: perf annotate basic tests             : Ok

 real   0m3.341s
 user   0m1.606s
 sys    0m0.362s
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
---
 tools/perf/tests/shell/annotate.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
index b072d9b97387..b28cd95b1d83 100755
--- a/tools/perf/tests/shell/annotate.sh
+++ b/tools/perf/tests/shell/annotate.sh
@@ -43,7 +43,7 @@ test_basic() {
   fi
 
   # Generate the annotated output file
-  perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
+  perf annotate --no-demangle -i "${perfdata}" --stdio 2> /dev/null | head -250 > "${perfout}"
 
   # check if it has the target symbol
   if ! grep "${testsym}" "${perfout}"
@@ -62,8 +62,8 @@ test_basic() {
   fi
 
   # check again with a target symbol name
-  if ! perf annotate -i "${perfdata}" "${testsym}" 2> /dev/null | \
-	  grep -m 3 "${disasm_regex}"
+  if ! perf annotate --no-demangle -i "${perfdata}" "${testsym}" 2> /dev/null | \
+	  head -250 | grep -m 3 "${disasm_regex}"
   then
     echo "Basic annotate [Failed: missing disasm output when specifying the target symbol]"
     err=1
@@ -71,8 +71,8 @@ test_basic() {
   fi
 
   # check one more with external objdump tool (forced by --objdump option)
-  if ! perf annotate -i "${perfdata}" --objdump=objdump 2> /dev/null | \
-	  grep -m 3 "${disasm_regex}"
+  if ! perf annotate --no-demangle -i "${perfdata}" --objdump=objdump 2> /dev/null | \
+	  head -250 | grep -m 3 "${disasm_regex}"
   then
     echo "Basic annotate [Failed: missing disasm output from non default disassembler (using --objdump)]"
     err=1
-- 
2.46.0


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

end of thread, other threads:[~2024-09-27 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 11:26 [PATCH] perf/test: Speed up test case perf annotate basic tests Thomas Richter
  -- strict thread matches above, loose matches on Subject: below --
2024-09-17  8:57 Thomas Richter
2024-09-17 12:51 ` James Clark
2024-09-17 12:52 ` James Clark
2024-09-27 17:01 ` 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).