Merge branch 'perf-tools' into perf-tools-next

To get some fixes in the perf test and JSON metrics into the development
branch.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Namhyung Kim
2024-02-12 12:19:21 -08:00
210 changed files with 2055 additions and 1016 deletions
+24 -10
View File
@@ -414,16 +414,30 @@ EOF
# start daemon
daemon_start ${config} test
# send 2 signals
perf daemon signal --config ${config} --session test
perf daemon signal --config ${config}
# stop daemon
daemon_exit ${config}
# count is 2 perf.data for signals and 1 for perf record finished
count=`ls ${base}/session-test/*perf.data* | wc -l`
if [ ${count} -ne 3 ]; then
# send 2 signals then exit. Do this in a loop watching the number of
# files to avoid races. If the loop retries more than 600 times then
# give up.
local retries=0
local signals=0
local success=0
while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do
local files
files=`ls ${base}/session-test/*perf.data* 2> /dev/null | wc -l`
if [ ${signals} -eq 0 ]; then
perf daemon signal --config ${config} --session test
signals=1
elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then
perf daemon signal --config ${config}
signals=2
elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then
daemon_exit ${config}
signals=3
elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then
success=1
fi
retries=$((${retries} +1))
done
if [ ${success} -eq 0 ]; then
error=1
echo "FAILED: perf data no generated"
fi
+18 -3
View File
@@ -3,17 +3,32 @@
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
shelldir=$(dirname "$0")
# shellcheck source=lib/setup_python.sh
. "${shelldir}"/lib/setup_python.sh
list_output=$(mktemp /tmp/__perf_test.list_output.json.XXXXX)
cleanup() {
rm -f "${list_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
test_list_json() {
echo "Json output test"
perf list -j | $PYTHON -m json.tool
perf list -j -o "${list_output}"
$PYTHON -m json.tool "${list_output}"
echo "Json output test [Success]"
}
test_list_json
exit $err
cleanup
exit 0
+9 -3
View File
@@ -36,8 +36,7 @@ test_db()
echo "DB test"
# Check if python script is supported
libpython=$(perf version --build-options | grep python | grep -cv OFF)
if [ "${libpython}" != "1" ] ; then
if perf version --build-options | grep python | grep -q OFF ; then
echo "SKIP: python scripting is not supported"
err=2
return
@@ -54,7 +53,14 @@ def sample_table(*args):
def call_path_table(*args):
print(f'call_path_table({args}')
_end_of_file_
perf record -g -o "${perfdatafile}" true
case $(uname -m)
in s390x)
cmd_flags="--call-graph dwarf -e cpu-clock";;
*)
cmd_flags="-g";;
esac
perf record $cmd_flags -o "${perfdatafile}" true
perf script -i "${perfdatafile}" -s "${db_test}"
echo "DB test [Success]"
}