check_perf_event_open || (echo "perf_event_open fails (check kernel.perf_event_paranoid + kernel config)"; exit 77)
expr `whoami` = "root" || (echo "not running as root"; exit 77)
-tempfiles test.out
-tempfiles gmon.*
+tempfiles test.out gmon.*
# run systemwide scan, no gprof output
-testrun timeout -p -sINT 10 ${abs_top_builddir}/src/stackprof -v 2>&1 | tee test.out
+testrun timeout -p --kill-after=5 10 ${abs_top_builddir}/src/stackprof -v 2>&1 | tee test.out
grep "^perf_event_attr configuration" test.out
grep "Starting stack profile collection systemwide" test.out
grep -E "^[0-9]+ " test.out # -- pid / sample counts entries
# run systemwide scan again, with gprof output
-testrun timeout -p -sINT 10 ${abs_top_builddir}/src/stackprof -v -g 2>&1 | tee test.out
+# reduce verbosity, bump post-processing timeout compared to the first run
+testrun timeout -p --kill-after=10 10 ${abs_top_builddir}/src/stackprof -g 2>&1 | tee test.out
grep "^perf_event_attr configuration" test.out
grep "Starting stack profile collection systemwide" test.out
grep -E "^buildid [0-9a-f]+" test.out
for f in gmon.*.out
do
+ tempfiles "$exe" gprof_output.txt
exe="`basename "$f" .out`.exe"
if [ ! -f "$exe" ]; then
buildid=`echo "$f" | cut -f2 -d.`
ln -s "`${abs_top_builddir}/debuginfod/debuginfod-find executable $buildid`" "$exe"
fi
exe_info="$exe (`readlink $exe`)"
- tempfiles "$exe"
- tempfiles gprof_output.txt
# try a plain gprof run on the executable
if gprof "$exe" "$f" > gprof_output.txt 2>&1; then
echo "$exe_info"
tempfiles perf-test.out
if ! testrun timeout 2 ${abs_top_builddir}/src/stackprof -v -- /bin/true > perf-test.out 2>&1; then
if grep -q "perf_event_open.*failed\|Operation note permitted\|Permission denied"; then
- exit 77
+ return 77
fi
fi
+ return 0
}
stackprof_debuginfod_setup() {
# TODO non networked version
- export DEBUGINFOD_URLS=https://debuginfod.elfutils.org/
+ #export DEBUGINFOD_URLS=https://debuginfod.elfutils.org/
+ return 0
}