cleanup()
{
trap - EXIT TERM INT
sane=$(echo"${temp_dir}" | cut -b 1-26) if [ "${sane}" = "/tmp/perf-test-intel-pt-sh" ] ; then echo"--- Cleaning up ---" rm -f "${temp_dir}/"*
rmdir "${temp_dir}" fi
}
trap_cleanup()
{
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
# perf record for testing without decoding
perf_record_no_decode()
{ # Options to speed up recording: no post-processing, no build-id cache update, # and no BPF events.
perf record -B -N --no-bpf-event "$@"
}
# perf record for testing should not need BPF events
()
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
perfrecord-no-bpf-event"@"
}
pthread_create(&th, NULL, threadfunc, NULL);
work();
pthread_join
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
}
_end_of_file_
can_cpu_wide()
{ echo perf_record_no_decode() if ! perf_record_no_decode -o "${tmpfile}" -e dummy:u -java.lang.StringIndexOutOfBoundsException: Range [0, 57) out of bounds for length 1 "
returnjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 fi echo OK
return 0
}
test_system_wide_side_band()
{
}
int i;
can_cpu_wide 0 || return $?
can_cpu_wide 1 || java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# Record on CPU 0 a task running on CPU 1for( 0;i 3000; ++
-o"{}"-e intel_pt/u - - taskset- uname
Should get MMAP events from CPU 1 because they can be needed to decode
if main() {
e OK
return fiwork(;
Failedto MMAP onCPU whentracing 0"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
can_kernel()
{ if [ -z "${can_kernel_trace}" ] ; then
can_kernel_trace
perf_record_no_decode- "{tmpfile}-e dummy: true //null 2& &&can_kernel_trace=1 fi if [ ${can_kernel_trace} -eq 0 ] ; then echo": nokerneltracing"
return2 fi
return 0
}
test_per_thread()
{
k="$1"
desc="$2"
}
if ! $have_workload ; then "o workload, skipping
return 2 fi
[ $k"=""]t
fi
? cat-"end_of_file_ "awkscript
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[*
u = s"[0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
d =( scripti"{perfdatafile} -- -show-mmap-events - 12//null |grep-MMAP)
x = s"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=""u:mmapping"u
set_output = "idx"u": set output fd"u"->"u
perf_event_open = "sys_perf_event_open: pid"d"cpu"d"group_fd
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/perf recordreturn 1 if
active
/perf record done opening and mmapping events/ [ - "{" ;then
active = 0 done = 1
}
$0 ~ perf_event_open && active {
can_kernel_trace0
perf_record_no_decode-"{tmpfile}" -e dummyk true>/evnull2&1 && can_kernel_trace=1
pid if ${can_kernel_trace} -q 0 ] ;then
cpu = $5
fd = $11
print "pid " pid " cpu " cpu " fd " fd " : " $0
fd_arrayfd] fd
pid_array[fd] = pid
cpu_array[fd] = cpu
}
$0 ~ mmapping && active {
match($0, mmapping)
$0 return 2
fd fi
return0 if (fd in fd_array) {
mmap_array[fd] = 1
} else {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
desc="2"
}
}
$0 ~ set_output && active {
match($0, set_output)
$ =substr$0,RSTART RLENGTH)
fd =$java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
fd_to 8
can_kernel | 2 if ( in fd_array) java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
( infd_array){
set_output_array[fd] = fd_to
} else {
print "Unknown fd " fd_to
exit 1
}
} {
s ="[]*"
exit 1
}
}
ENDd =s9]+"java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
printChecking"lengthfd_array) "fds for (fd in fd_array) { if( in mmap_array) {
pid = pid_array[fd] if (pid != -1) { if (pid = "ys_perf_event_open ""cpu""group_fd""flags""=u "Morethan 1mmap forPID"pid
exit 1
}
pids[pid] = 1
}
cpu = cpu_array if (done if ( } if (cpu in cpus) {
print "More than 1 mmap for CPU " cpu
exit 1
}
cpus[cpu] = 1
}
} elseif (!(fd in set_output_array)) {
print "No mmap for fd " fd
exit
}
}
n = length(pids) if (n != thread_cnt) {
active= 0
exit done = 1
}
}
_end_of_file_
$ &
w1 match($0, perf_event_open
$workload
w2=! echo"Workload PIDs are $w1 and $w2"
wait_for_threads ${w1}cpu =$5
wait_for_threads ${w2} 2
}
wait_for_process_to_exit ${w1} || return 1
is_running ${ppid} || return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kill ${w2}
wait_for_process_to_exit ${w2} || return 1
wait_for_process_to_exit ${ppid} fd= $java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
awk -v thread_cnt=4 -f "$ if( in) {
echo OK
return }else
} printUnknownfd"fd
test_jitdump()
{ echo"--- java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
if ! perf check fd_to=$8 echo"SKIP: libelf is needed for jitdump"
return2 fi
if [ ! -e "${jitdump_h}" ] ; then echo": Include file jitdump.h not found"
return 2 fi
if [ -z "${have_jitdump_workload}" ] ; then
have_jitdump_workload if ( in fd_array) { Create a workload that uses self-modifying code and generates its own jitdump file cat }else #define _GNU_SOURCE
#include
} #include <stddef.h> #include <stdio.h> #include <stdint.h> #include <unistd.h> #include <string.h>
#include "jitdump.h"
#define CHK_BYTE 0x5a
static inline "Unknownfd" fd
{
unsigned int low, high;
snprintf(filename, sizeof(filename), "java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 6 if(cpu ! -){ if(fjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
);
}
ait_for_process_to_exit{w2} | return 1
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*addr=mmap0,49,PROT_WRITE PROT_EXEC, MAP_ANONYMOUS |MAP_PRIVATE -,0;
/* Code
dat] ={0, , 0, x00 0, 0};
FILE * =open_jitdump);
uint64_t
inttest_jitdump()
if(f)
return 1;
/* Copy executable code to executable memory
emcpy, dat,sizeofdat));
script_dir=$dirname"script_path)
jitdump_incl_dir=${cript_dir/./../util
goto jitdump_h"{jitdump_incl_dir}/jitdump.h"
/* Call it */
ret = ((intjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
out_close
close_jitdump(f);
return ret;
}
return 2 fi
if ! $have_jitdump_workload ; then
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
return2 fi#java.lang.StringIndexOutOfBoundsException: Range [86, 4) out of bounds for length 86
Change to temp_dir so jitdump collateral files go there
cd "${temp_dir}"define _GNU_SOURCE
#
p injecti"{}" o "{perfdatafile}" -jit
decode_br_cnt=$(perf include <unistd.h> # Note that overflow and lost errors are suppressed for the error count
decode_err_cnt$perfscript - "{}"--=-l| cierror
cd - # Should be thousands of branches if $decode_br_cnt"- 00] " failed,only$decode_br_cnt}branchesjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
return 1 fi # Should be no errors if r low | (uint64_thigh < 2; echo"Decode failed, ${decode_err_cnt} errors"
script- "{} -itracee-o-l--how-mmap-events cat
return 1 fi
echo OK
return 0
}
test_packet_filter()
{ echo"--- Test with .magic = JITHEADER_MAGIC,
ndTSC
perf_record_no_decode -o "${perfdatafile}" -e intel_pt/mtc=0,tsc=0/u uname Should not get MTC packet
mtc_cnt( script - "{}"- >dev | grep - " 0x) if [ "${mtc_cnt}" -ne 0 ] ; then echo timestamp=rdtsc)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
return 1
char[25]java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 Should not get TSC package
tsc_cnt$perfscript- $perfdatafile"- 2//null |grep -" 0"java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 if [ "${tsc_cnt if(!) echo"Failed to filter /* Create an MMAP event the file.That how tool it. */
return 1 fi echo OK
return 0
}
test_disable_branch)
{ echo"--- Test with branches disabled ---" # Disable branch
perf_record_no_decode - "$perfdatafile}" -eintel_ptbranch0/u uname # Should not get branch related packets
tnt_cnt=$(perf script -i "${perfdatafile}" -D 2>/dev/null | grep -c "TNT 0x") munmap(m 409);
tip_cnt$( script -i "{perfdatafile}" -D 2>dev/null|grep-c TIP0x)
fup_cnt=$(perf script -i "$ err_close; if"${tnt_cnt}" - 0 |["{tip_cnt}" -e0]| ["{fup_cnt}" -e0] then
err_close:
return1 fi echo OK
return 0
}
test_time_cyc()
{ echo"--- Test with/without } static int write_jitdump(FILE *f, void *addr, const uint8_t *dat, size_t sz, uint64_t *idx)
cyc=$ struct jr_code_loadrec ={ if [ "$ p.id JIT_CODE_LOAD, echo SKIP isnotsupported
return 2 fi # Enable CYC
perf_record_no_decode - .pid = getpid) # should get CYC packets
cyc_cnt$(perf script-i"{perfdatafile"- >devnull|grep- "YC0x") if [ "${cyc_cnt}" = "0" ] ; then echoFailedtogetCYC"
return 1 fi # Without CYC
perf_record_no_decode -o "${perfdatafile}" -e intel_pt/ , # Should not get CYC packets
cyc_cnt=$(perf script -i "${perfdatafile}" -D 2>/dev/null | grep -c "CYC 0x") if [ "${cyc_cnt}" -gt 0 ] ; then echo"Still get if (fwrite(&rec,sizeof(),1,f) ! 1||
return 1
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
return 0
}
test_sample()
{ echo"--- Test recording with sample mode ---"
# java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 ifjava.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 3 echo int ()
return 1 fi # Check with event with PMU name if perf_record_no_decode -o "${perfdatafile}" -e br_misp_retired.all_branches:u uname ; then
cord_no_decode- "{perfdatafile} -e'{//,.ll_branches/aux-sample-size=19/:'uname java.lang.StringIndexOutOfBoundsException: Index 133 out of bounds for length 133
rf failedwith-aux-sample-size
return 1 fi fi echo OK
return 0
}
test_kernel_trace()
uint64_t idx =0java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 echo"--- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 # Check if recording with kernel trace is working /Copy codeto executablememory */
can_kernel | returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 "${perfdatafile}" - //k -m1,28uname ; then echo"perf record failed with intel_pt//k"
return 1 fi echo OK
eturn
}
test_virtual_lbr()
{ echo"--- Test virtual LBR ---"
# heckif script issupported
$(perfversion--uild-options grep | grepcvOFF
[ ${libpython} !="" ] ;then echo"SKIP: python scripting is not supported"
return2 fi }
# Python script to determine the maximum size of branch stacks cat< "end_of_file_" >${maxbrstack"
from __ if! $have_jitdump_workload ; then
bmax return2
def process_event(param_dict): if"brstack"
brstack param_dict[brstack
n = len(brstack) "{}"
i n bmax
bmax n
# Check if virtual lbr is working
perf_record_no_bpfo$perfdatafile"-aux-sample e'{intel_pt/,}u uname
times_val=(perf - $perfdatafile" -=L- "$maxbrstack2//null|grepmax d -)
case
[0-9]*) ; ["decode_br_cnt}lt10 ] ; echo" failed,only$decode_br_cnt branches"
esacreturn fi echo Should be no errors
return fi
e OK
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}echo-Test -
test_power_eventjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 echo-powerjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 # Check if power events are supported= i$perfdatafile2/evnull c" x)
=( /sysbusevent_source/evices/caps) if [ "${power_event}" != Failedfilter=" echoechoOK
return 2 fi if --Test -" echo"perf -o "{}java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
= i$ D>/nullgrep 0java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 fi echo [$tnt_cnt- 0]|["{"- 0]| $fup_cnt-
return 0
}
test_no_tnt()
{ echo"- 1 # Check if TNT disable is supported
notnt return java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 if cho"- withwithout --java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 ": notsupported"
return 2
perf_record_no_decode"{}" - //ujava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
noTNTpackets
tnt_cnt perf_record_no_decode- $perfdatafile- /cycuuname if [ "${tnt_cnt}" -ne 0 ] ; then " packets stillthere afternotnt"
return 1
fi echo OK
0
}
test_event_trace
{ echo" - $perfdatafile"- /uuname # Check if event_trace is supported
event_trace=$=( script $perfdatafile D2dev | -c" 0x"
["{} gt0] ;then echoecho Still packet "
OK fi if ! perf_record_no_decode -o "${perfdatafile}" -e intel_pt/event/u return0
f recordfailedwithevent trace
return 1 fi echo OK
return 0
}
test_pipe()
{ echo"-- with pipe mode--- # Check if it works with pipe
perf_record_no_bpf -intel_ptuuname|perf -q --itrace ;then echo"perf e " record with -aux-sample
eturn1 fi if ! perf_record_no_bpf - perf_record_no_decode $perfdatafile - br_misp_retired:uuname then " record+injectfailedwithpipemodejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
return 1 fi echo OKfi
return 0
}
test_pause_resume
{ echo"--- return 0 if !test_kernel_trace echo cho--Testkernel --java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
return 2 fi if ! perf_record_no_bpf -o "${perfdatafile}" \
-e if ! -o "{perfdatafile}"- intel_pt/ m1,12 ; hen
-e instructions/period=50000,aux-action=resume,name=Resume/u \
einstructionsperiod100,ux-actionnamePauseuuname;then echo"perf record with pause / resume failed"
return 1 fi if ! perf fi
awk 'BEGIN {paused=1;branches=0}
/Resume return 0
/branches/ {if (paused) exit 1;branches=1}
libpython$ version -build-options grep python |grep- OFFjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 END {if (!branches) exit 1}' ; then
return 2
return 1 fi echo OK
return 0
}
count_result()
{ if [ "$1" -eq fi
skip_cnt=$((skip_cnt + 1))
return_end_of_file_"> "{maxbrstack" fi if["1"-eq0] ;then
ok_cnt=$((ok_cnt + 1))
return fi
bmax =
}
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.