Skip to content

Commit

Permalink
Profiling for perf tests
Browse files Browse the repository at this point in the history
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 <jwk404@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Tony Nguyen <tony.nguyen@delphix.com>
External-issue: LX-971
Closes #7549
  • Loading branch information
tonynguien authored and behlendorf committed May 22, 2018
1 parent a430cef commit ba863d0
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 10 deletions.
1 change: 1 addition & 0 deletions tests/zfs-tests/include/commands.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export SYSTEM_FILES='arp
openssl
parted
pax
perf
pgrep
ping
pkill
Expand Down
9 changes: 6 additions & 3 deletions tests/zfs-tests/tests/perf/regression/random_reads.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
"iostat")
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
"iostat" "$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
Expand Down
5 changes: 4 additions & 1 deletion tests/zfs-tests/tests/perf/regression/random_readwrite.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
"iostat")
"iostat" "$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
Expand Down
5 changes: 4 additions & 1 deletion tests/zfs-tests/tests/perf/regression/random_writes.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ fi
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
"iostat")
"iostat" "$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/perf/regression/sequential_reads.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
"$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
"$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ export TESTFS=$PERFPOOL/$TESTCLONE
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
"$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ log_must fio $FIO_SCRIPTS/mkfiles.fio
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat"
"$perf_record_cmd" "perf")
else
export collect_scripts=("kstat zfs:0 1" "kstat" "vmstat -T d 1" "vmstat"
"mpstat -T d 1" "mpstat" "iostat -T d -xcnz 1" "iostat"
Expand Down
5 changes: 4 additions & 1 deletion tests/zfs-tests/tests/perf/regression/sequential_writes.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ fi
lun_list=$(pool_to_lun_list $PERFPOOL)
log_note "Collecting backend IO stats with lun list $lun_list"
if is_linux; then
typeset perf_record_cmd="perf record -F 99 -a -g -q \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
"iostat")
"iostat" "$perf_record_cmd" "perf")
else
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
Expand Down

0 comments on commit ba863d0

Please sign in to comment.