mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-04 22:54:43 -04:00
perf test kvm: Add stat live testing
Ensure the `perf kvm stat live -p ..` has some basic functionality. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrew Jones <ajones@ventanamicro.com> Cc: Anubhav Shelat <ashelat@redhat.com> Cc: Anup Patel <anup@brainfault.org> Cc: Athira Rajeev <atrajeev@linux.ibm.com> Cc: Blake Jones <blakejones@google.com> Cc: Chun-Tse Shao <ctshao@google.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Howard Chu <howardchu95@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <pjw@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Quan Zhou <zhouquan@iscas.ac.cn> Cc: Shimin Guo <shimin.guo@skydio.com> Cc: Swapnil Sapkal <swapnil.sapkal@amd.com> Cc: Thomas Falcon <thomas.falcon@intel.com> Cc: Will Deacon <will@kernel.org> Cc: Yunseong Kim <ysk@kzalloc.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
b5c9bcde61
commit
d2ac7e4418
@@ -7,9 +7,10 @@ set -e
|
||||
err=0
|
||||
perfdata=$(mktemp /tmp/__perf_kvm_test.perf.data.XXXXX)
|
||||
qemu_pid_file=$(mktemp /tmp/__perf_kvm_test.qemu.pid.XXXXX)
|
||||
log_file=$(mktemp /tmp/__perf_kvm_test.live_log.XXXXX)
|
||||
|
||||
cleanup() {
|
||||
rm -f "${perfdata}"
|
||||
rm -f "${perfdata}" "${log_file}"
|
||||
if [ -f "${qemu_pid_file}" ]; then
|
||||
if [ -s "${qemu_pid_file}" ]; then
|
||||
qemu_pid=$(cat "${qemu_pid_file}")
|
||||
@@ -96,6 +97,32 @@ test_kvm_buildid_list() {
|
||||
echo "perf kvm buildid-list test [Success]"
|
||||
}
|
||||
|
||||
test_kvm_stat_live() {
|
||||
echo "Testing perf kvm stat live"
|
||||
|
||||
# Run perf kvm live for 5 seconds, monitoring that PID
|
||||
# Use sleep to keep stdin open but silent, preventing EOF loop or interactive spam
|
||||
if ! sleep 10 | timeout 5s perf kvm stat live -p "${qemu_pid}" > "${log_file}" 2>&1; then
|
||||
retval=$?
|
||||
if [ $retval -ne 124 ] && [ $retval -ne 0 ]; then
|
||||
echo "perf kvm stat live [Failed: perf kvm stat live failed to start or run (ret=$retval)]"
|
||||
head -n 50 "${log_file}"
|
||||
err=1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for some sample data (percentage)
|
||||
if ! grep -E -q "[0-9]+\.[0-9]+%" "${log_file}"; then
|
||||
echo "perf kvm stat live [Failed: no sample percentage found]"
|
||||
head -n 50 "${log_file}"
|
||||
err=1
|
||||
return
|
||||
fi
|
||||
|
||||
echo "perf kvm stat live test [Success]"
|
||||
}
|
||||
|
||||
setup_qemu() {
|
||||
# Find qemu
|
||||
if [ "$(uname -m)" = "x86_64" ]; then
|
||||
@@ -148,6 +175,7 @@ if [ $err -eq 0 ]; then
|
||||
test_kvm_stat
|
||||
test_kvm_record_report
|
||||
test_kvm_buildid_list
|
||||
test_kvm_stat_live
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
Reference in New Issue
Block a user