Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba863d0

Browse files
tonynguienbehlendorf
authored andcommitted
Profiling for perf tests
Stack profiling is quite useful and Linux ZFS test suite does not current collect that data. Linux perf is a common tool for this purpose though the perf record data file can be quite large. With this change, Linux ZFS perf tests capture perf record data if perf is installed on the system and PERF_DO_PROFILING environment variable is set. Reviewed by: John Wren Kennedy <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> External-issue: LX-971 Closes openzfs#7549
1 parent a430cef commit ba863d0

9 files changed

+39
-10
lines changed

tests/zfs-tests/include/commands.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export SYSTEM_FILES='arp
8484
openssl
8585
parted
8686
pax
87+
perf
8788
pgrep
8889
ping
8990
pkill

tests/zfs-tests/tests/perf/regression/random_reads.ksh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
8585
lun_list=$(pool_to_lun_list $PERFPOOL)
8686
log_note "Collecting backend IO stats with lun list $lun_list"
8787
if is_linux; then
88-
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
89-
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
90-
"iostat")
88+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
89+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
90+
91+
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
92+
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
93+
"iostat" "$perf_record_cmd" "perf")
9194
else
9295
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
9396
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")

tests/zfs-tests/tests/perf/regression/random_readwrite.ksh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
8585
lun_list=$(pool_to_lun_list $PERFPOOL)
8686
log_note "Collecting backend IO stats with lun list $lun_list"
8787
if is_linux; then
88+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
89+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
90+
8891
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
8992
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
90-
"iostat")
93+
"iostat" "$perf_record_cmd" "perf")
9194
else
9295
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
9396
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")

tests/zfs-tests/tests/perf/regression/random_writes.ksh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ fi
7777
lun_list=$(pool_to_lun_list $PERFPOOL)
7878
log_note "Collecting backend IO stats with lun list $lun_list"
7979
if is_linux; then
80+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
81+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
82+
8083
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
8184
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
82-
"iostat")
85+
"iostat" "$perf_record_cmd" "perf")
8386
else
8487
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
8588
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")

tests/zfs-tests/tests/perf/regression/sequential_reads.ksh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
8585
lun_list=$(pool_to_lun_list $PERFPOOL)
8686
log_note "Collecting backend IO stats with lun list $lun_list"
8787
if is_linux; then
88+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
89+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
90+
8891
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
8992
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
90-
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
93+
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
94+
"$perf_record_cmd" "perf")
9195
else
9296
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
9397
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"

tests/zfs-tests/tests/perf/regression/sequential_reads_arc_cached.ksh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
7575
lun_list=$(pool_to_lun_list $PERFPOOL)
7676
log_note "Collecting backend IO stats with lun list $lun_list"
7777
if is_linux; then
78+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
79+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
80+
7881
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
7982
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
80-
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
83+
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
84+
"$perf_record_cmd" "perf")
8185
else
8286
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
8387
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"

tests/zfs-tests/tests/perf/regression/sequential_reads_arc_cached_clone.ksh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ export TESTFS=$PERFPOOL/$TESTCLONE
9191
lun_list=$(pool_to_lun_list $PERFPOOL)
9292
log_note "Collecting backend IO stats with lun list $lun_list"
9393
if is_linux; then
94+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
95+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
96+
9497
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
9598
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
96-
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
99+
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
100+
"$perf_record_cmd" "perf")
97101
else
98102
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
99103
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"

tests/zfs-tests/tests/perf/regression/sequential_reads_dbuf_cached.ksh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
7777
lun_list=$(pool_to_lun_list $PERFPOOL)
7878
log_note "Collecting backend IO stats with lun list $lun_list"
7979
if is_linux; then
80+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
81+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
82+
8083
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
8184
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
82-
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
85+
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
86+
"$perf_record_cmd" "perf")
8387
else
8488
export collect_scripts=("kstat zfs:0 1" "kstat" "vmstat -T d 1" "vmstat"
8589
"mpstat -T d 1" "mpstat" "iostat -T d -xcnz 1" "iostat"

tests/zfs-tests/tests/perf/regression/sequential_writes.ksh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ fi
7777
lun_list=$(pool_to_lun_list $PERFPOOL)
7878
log_note "Collecting backend IO stats with lun list $lun_list"
7979
if is_linux; then
80+
typeset perf_record_cmd="perf record -F 99 -a -g -q \
81+
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
82+
8083
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
8184
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
82-
"iostat")
85+
"iostat" "$perf_record_cmd" "perf")
8386
else
8487
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
8588
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")

0 commit comments

Comments
 (0)