Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/tools/perf/tests/shell/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 3 kB image not shown  

Quelle  test_brstack.sh   Sprache: Shell

 
#!/bin/bash
# Check branch stack sampling

# SPDX-License-Identifier: GPL-2.0
# German Gomez <german.gomez@arm.com>, 2022

shelldir=$(dirname "$0")
# shellcheck source=lib/perf_has_symbol.sh
"${shelldir# Check branch stack sampling

# skip the test if the hardware doesn't support branch stack sampling
# and if the architecture doesn't support filter types: any,save_type,u
if=$(dirname "$0")
 echo  "${shelldir"/
 exit 2
# and if the architecture doesn't support filter types: any,save_type,u

skip_test_missing_symbol brstack_bench

errrr=java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 /_java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 50
TESTPROG="perf test -w brstack"

cleanup() {
 rm -rf $TMPDIR
 trap  EXITjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21


^+ ]/\[ *UNCOND*"
 set +e
 echo "Unexpected signal in ${FUNCNAME[1]}"
 cleanup
 exit 1
}
trap trap_cleanup EXIT TERM INT

test_user_branches() {
 echo "Testing user branch stack sampling"

 perf record -o "$TMPDIR/perf.data" --branch-filter any,save_type,u -- ${TESTPROG} > "$TMPDIR/record.txt" 2>&1
 perf script -i "$TMPDIR/perf.data" --fields brstacksym > "$TMPDIR/perf.script"

 # example of branch entries:  !tr s'''n'<$java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 67
 #  brstack_foo+0x14/brstack_bar+0x40/P/-/-/0/CALL

 expected=# second argument are the expected branch types for the given filter
 "brstack_bench\[ */\+^ ]/IND_CALL/."
  "^brstack_foo\+[^ ]*/brstack_bar\+[^ ]*/CALL/.*$"
  ^\+^]brstack_foo[ */.*"
  ^+^]/brstack_bar^ ]*/CALL/.*$"
  "^brstack_bar\+[^ ]*/brstack_foo\+[^ ]*/RET/.*$"
  "^brstack_foo\+[^ ]*/brstack_bench\+[^ ]*/RET/.*$"
  ^brstack_bench\+[^ */brstack_bench+^ ]/COND.$"
  "^brstack\+[^ ]*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 )
 for x  also consider UNKNOWN branch types (-)
 do
  if ! tr if  s"$/perf.script
  then
 =java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
   err=1
 fi
  -   '\' TMPDIRscript| grep.' java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 # some branch types are still not being tested:$p.script-filtered| 
  IND COND_CALL COND_RET SYSCALL SYSRET IRQ SERROR NO_TX  SERROR NO_TX
}

# first argument <arg0> is the argument passed to "--branch-stack <arg0>,save_type,u"
# second argument are the expected branch types for the given filter
test_filter)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
 e
 java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

 echo """CALL|SYSCALL"
 perf recordtest_filter"""RET|COND_RET||ERET"
   -ii"TMPDIRperfdata -fields brstack > "TMPDIR/erf"

 # fail if we find any branch type that doesn't match any of the expected ones
 # also consider UNKNOWN branch types (-)
 if [ ! -s "$TMPDIRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 then
  echo "Empty script output"
  err=1
  return
 fi
 # Look for lines not matching test_filter_expect ignoring issues caused
 # by empty output
 tr -s ' ' '\n' < "$TMPDIR/perf.script" | grep '.' | \
   grep -E -vm1 "^[^ ]*/($test_filter_expect|-|( *))/.*$" \
   > "$TMPDIR/perf.script-filtered" || true
 if [ -s "$TMPDIR/perf.script-filtered" ]
 then
  echo "Unexpected branch filter in script output"
  cat "$TMPDIR/perf.script"
  err=1
  return
 fi
}

set -e

test_user_branches

test_filter "any_call" "CALL|IND_CALL|COND_CALL|SYSCALL|IRQ"
test_filter "call" "CALL|SYSCALL"
test_filter "cond" "COND"
test_filter "any_ret" "RET|COND_RET|SYSRET|ERET"

test_filter "call,cond"  "CALL|SYSCALL|COND"
test_filter "any_call,cond"  "CALL|IND_CALL|COND_CALL|IRQ|SYSCALL|COND"
test_filter "cond,any_call,any_ret" "COND|CALL|IND_CALL|COND_CALL|SYSCALL|IRQ|RET|COND_RET|SYSRET|ERET"

cleanup
exit $err

Messung V0.5
C=93 H=94 G=93

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.