Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
d2ac7e44 b5c9bcde

+29 -1
+29 -1
tools/perf/tests/shell/kvm.sh
··· 7 7 err=0 8 8 perfdata=$(mktemp /tmp/__perf_kvm_test.perf.data.XXXXX) 9 9 qemu_pid_file=$(mktemp /tmp/__perf_kvm_test.qemu.pid.XXXXX) 10 + log_file=$(mktemp /tmp/__perf_kvm_test.live_log.XXXXX) 10 11 11 12 cleanup() { 12 - rm -f "${perfdata}" 13 + rm -f "${perfdata}" "${log_file}" 13 14 if [ -f "${qemu_pid_file}" ]; then 14 15 if [ -s "${qemu_pid_file}" ]; then 15 16 qemu_pid=$(cat "${qemu_pid_file}") ··· 97 96 echo "perf kvm buildid-list test [Success]" 98 97 } 99 98 99 + test_kvm_stat_live() { 100 + echo "Testing perf kvm stat live" 101 + 102 + # Run perf kvm live for 5 seconds, monitoring that PID 103 + # Use sleep to keep stdin open but silent, preventing EOF loop or interactive spam 104 + if ! sleep 10 | timeout 5s perf kvm stat live -p "${qemu_pid}" > "${log_file}" 2>&1; then 105 + retval=$? 106 + if [ $retval -ne 124 ] && [ $retval -ne 0 ]; then 107 + echo "perf kvm stat live [Failed: perf kvm stat live failed to start or run (ret=$retval)]" 108 + head -n 50 "${log_file}" 109 + err=1 110 + return 111 + fi 112 + fi 113 + 114 + # Check for some sample data (percentage) 115 + if ! grep -E -q "[0-9]+\.[0-9]+%" "${log_file}"; then 116 + echo "perf kvm stat live [Failed: no sample percentage found]" 117 + head -n 50 "${log_file}" 118 + err=1 119 + return 120 + fi 121 + 122 + echo "perf kvm stat live test [Success]" 123 + } 124 + 100 125 setup_qemu() { 101 126 # Find qemu 102 127 if [ "$(uname -m)" = "x86_64" ]; then ··· 175 148 test_kvm_stat 176 149 test_kvm_record_report 177 150 test_kvm_buildid_list 151 + test_kvm_stat_live 178 152 fi 179 153 180 154 cleanup