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: Update perf lock contention test

Add test cases for the task and addr aggregation modes.

$ sudo ./perf test -v contention
86: kernel lock contention analysis test :
--- start ---
test child forked, pid 680006
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
test child finished with 0
---- end ----
kernel lock contention analysis test: Ok

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
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/20221209190727.759804-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
22ddcb6b 688d2e8d

+48
+48
tools/perf/tests/shell/lock_contention.sh
··· 77 77 fi 78 78 } 79 79 80 + test_aggr_task() 81 + { 82 + echo "Testing perf lock contention --threads" 83 + perf lock contention -i ${perfdata} -t -E 1 -q 2> ${result} 84 + if [ $(cat "${result}" | wc -l) != "1" ]; then 85 + echo "[Fail] Recorded result count is not 1:" $(cat "${result}" | wc -l) 86 + err=1 87 + exit 88 + fi 89 + 90 + if ! perf lock con -b true > /dev/null 2>&1 ; then 91 + return 92 + fi 93 + 94 + # the perf lock contention output goes to the stderr 95 + perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result} 96 + if [ $(cat "${result}" | wc -l) != "1" ]; then 97 + echo "[Fail] BPF result count is not 1:" $(cat "${result}" | wc -l) 98 + err=1 99 + exit 100 + fi 101 + } 102 + 103 + test_aggr_addr() 104 + { 105 + echo "Testing perf lock contention --lock-addr" 106 + perf lock contention -i ${perfdata} -l -E 1 -q 2> ${result} 107 + if [ $(cat "${result}" | wc -l) != "1" ]; then 108 + echo "[Fail] Recorded result count is not 1:" $(cat "${result}" | wc -l) 109 + err=1 110 + exit 111 + fi 112 + 113 + if ! perf lock con -b true > /dev/null 2>&1 ; then 114 + return 115 + fi 116 + 117 + # the perf lock contention output goes to the stderr 118 + perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result} 119 + if [ $(cat "${result}" | wc -l) != "1" ]; then 120 + echo "[Fail] BPF result count is not 1:" $(cat "${result}" | wc -l) 121 + err=1 122 + exit 123 + fi 124 + } 125 + 80 126 check 81 127 82 128 test_record 83 129 test_bpf 84 130 test_record_concurrent 131 + test_aggr_task 132 + test_aggr_addr 85 133 86 134 exit ${err}