mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-06 17:39:01 +01:00
perf test: Add a test for default perf stat command
Test that one cycles event is opened for each core PMU when "perf stat" is run without arguments. The event line can either be output as "pmu/cycles/" or just "cycles" if there is only one PMU. Include 2 spaces for padding in the one PMU case to avoid matching when the word cycles is included in metric descriptions. Acked-by: Namhyung Kim <[email protected]> Acked-by: Kan Liang <[email protected]> Signed-off-by: James Clark <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Dominique Martinet <[email protected]> Cc: Colin Ian King <[email protected]> Cc: Howard Chu <[email protected]> Cc: Ze Gao <[email protected]> Cc: Yicong Yang <[email protected]> Cc: Weilin Wang <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mike Leach <[email protected]> Cc: Jing Zhang <[email protected]> Cc: Yang Li <[email protected]> Cc: Leo Yan <[email protected]> Cc: [email protected] Cc: Athira Rajeev <[email protected]> Cc: [email protected] Cc: Yanteng Si <[email protected]> Cc: Sun Haiyong <[email protected]> Cc: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
This commit is contained in:
1 parent
14b6b269f4
commit
65d1182191
1 file changed
+25
@@ -148,6 +148,30 @@ test_cputype() {
|
||||
echo "cputype test [Success]"
|
||||
}
|
||||
|
||||
test_hybrid() {
|
||||
# Test the default stat command on hybrid devices opens one cycles event for
|
||||
# each CPU type.
|
||||
echo "hybrid test"
|
||||
|
||||
# Count the number of core PMUs, assume minimum of 1
|
||||
pmus=$(ls /sys/bus/event_source/devices/*/cpus 2>/dev/null | wc -l)
|
||||
if [ "$pmus" -lt 1 ]
|
||||
then
|
||||
pmus=1
|
||||
fi
|
||||
|
||||
# Run default Perf stat
|
||||
cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l)
|
||||
|
||||
if [ "$pmus" -ne "$cycles_events" ]
|
||||
then
|
||||
echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]"
|
||||
err=1
|
||||
return
|
||||
fi
|
||||
echo "hybrid test [Success]"
|
||||
}
|
||||
|
||||
test_default_stat
|
||||
test_stat_record_report
|
||||
test_stat_record_script
|
||||
@@ -155,4 +179,5 @@ test_stat_repeat_weak_groups
|
||||
test_topdown_groups
|
||||
test_topdown_weak_groups
|
||||
test_cputype
|
||||
test_hybrid
|
||||
exit $err
|
||||
Reference in new issue
Block a user