Skip to content

Commit 22ddcb6

Browse files
namhyungacmel
authored andcommitted
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 <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Blake Jones <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 688d2e8 commit 22ddcb6

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tools/perf/tests/shell/lock_contention.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,58 @@ test_record_concurrent()
7777
fi
7878
}
7979

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+
80126
check
81127

82128
test_record
83129
test_bpf
84130
test_record_concurrent
131+
test_aggr_task
132+
test_aggr_addr
85133

86134
exit ${err}

0 commit comments

Comments
 (0)