mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
perf test: Update 'perf lock contention' test
Add more tests for the new filters. $ sudo perf test contention -v 87: kernel lock contention analysis test : --- start --- test child forked, pid 412379 Testing perf lock record and perf lock contention Testing perf lock contention --use-bpf Testing perf lock record and perf lock contention at the same time Testing perf lock contention --threads Testing perf lock contention --lock-addr Testing perf lock contention --type-filter Testing perf lock contention --lock-filter test child finished with 0 ---- end ---- kernel lock contention analysis test: Ok Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Blake Jones <blakejones@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20221219201732.460111-7-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5e3febe7b7
commit
cb459c89b7
@ -115,7 +115,7 @@ test_aggr_addr()
|
||||
fi
|
||||
|
||||
# the perf lock contention output goes to the stderr
|
||||
perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
|
||||
perf lock con -a -b -l -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
|
||||
if [ $(cat "${result}" | wc -l) != "1" ]; then
|
||||
echo "[Fail] BPF result count is not 1:" $(cat "${result}" | wc -l)
|
||||
err=1
|
||||
@ -123,6 +123,60 @@ test_aggr_addr()
|
||||
fi
|
||||
}
|
||||
|
||||
test_type_filter()
|
||||
{
|
||||
echo "Testing perf lock contention --type-filter (w/ spinlock)"
|
||||
perf lock contention -i ${perfdata} -Y spinlock -q 2> ${result}
|
||||
if [ $(grep -c -v spinlock "${result}") != "0" ]; then
|
||||
echo "[Fail] Recorded should not have non-spinlocks:" $(cat "${result}")
|
||||
err=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! perf lock con -b true > /dev/null 2>&1 ; then
|
||||
return
|
||||
fi
|
||||
|
||||
perf lock con -a -b -Y spinlock -q -- perf bench sched messaging > /dev/null 2> ${result}
|
||||
if [ $(grep -c -v spinlock "${result}") != "0" ]; then
|
||||
echo "[Fail] Recorded should not have non-spinlocks:" $(cat "${result}")
|
||||
err=1
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
test_lock_filter()
|
||||
{
|
||||
echo "Testing perf lock contention --lock-filter (w/ tasklist_lock)"
|
||||
perf lock contention -i ${perfdata} -l -q 2> ${result}
|
||||
if [ $(grep -c tasklist_lock "${result}") != "1" ]; then
|
||||
echo "[Skip] Could not find 'tasklist_lock'"
|
||||
return
|
||||
fi
|
||||
|
||||
perf lock contention -i ${perfdata} -L tasklist_lock -q 2> ${result}
|
||||
|
||||
# find out the type of tasklist_lock
|
||||
local type=$(head -1 "${result}" | awk '{ print $8 }' | sed -e 's/:.*//')
|
||||
|
||||
if [ $(grep -c -v "${type}" "${result}") != "0" ]; then
|
||||
echo "[Fail] Recorded should not have non-${type} locks:" $(cat "${result}")
|
||||
err=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! perf lock con -b true > /dev/null 2>&1 ; then
|
||||
return
|
||||
fi
|
||||
|
||||
perf lock con -a -b -L tasklist_lock -q -- perf bench sched messaging > /dev/null 2> ${result}
|
||||
if [ $(grep -c -v "${type}" "${result}") != "0" ]; then
|
||||
echo "[Fail] Recorded should not have non-${type} locks:" $(cat "${result}")
|
||||
err=1
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
check
|
||||
|
||||
test_record
|
||||
@ -130,5 +184,7 @@ test_bpf
|
||||
test_record_concurrent
|
||||
test_aggr_task
|
||||
test_aggr_addr
|
||||
test_type_filter
|
||||
test_lock_filter
|
||||
|
||||
exit ${err}
|
||||
|
Loading…
x
Reference in New Issue
Block a user