Skip to content

Commit

Permalink
Allow perf record command to be specified in env (openzfs#47)
Browse files Browse the repository at this point in the history
On 5.11 kernels, the `--call-graph dwarf,8192` option to perf causes
it to crash. This change allows callers to specify a different perf
invocation via the PERF_RECORD_CMD environment variable.
  • Loading branch information
jwk404 authored Dec 3, 2021
1 parent 4b9e2e2 commit 96c1168
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 50 deletions.
2 changes: 2 additions & 0 deletions tests/zfs-tests/tests/perf/perf.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export PERF_RUNTIME=${PERF_RUNTIME:-'180'}
export PERF_RANDSEED=${PERF_RANDSEED:-'1234'}
export PERF_COMPPERCENT=${PERF_COMPPERCENT:-'66'}
export PERF_COMPCHUNK=${PERF_COMPCHUNK:-'4096'}
export PERF_RECORD_CMD=${PERF_RECORD_CMD:-"perf record --call-graph \
dwarf,8192 -F 49 -agq -o /dev/stdout -- sleep ${PERF_RUNTIME}"}

# Default to JSON for fio output
export PERF_FIO_FORMAT=${PERF_FIO_FORMAT:-'json'}
Expand Down
13 changes: 3 additions & 10 deletions tests/zfs-tests/tests/perf/regression/file_deletion.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

#
# Copyright (c) 2015, 2020 by Delphix. All rights reserved.
# Copyright (c) 2015, 2021 by Delphix. All rights reserved.
#

#
Expand Down Expand Up @@ -51,18 +51,13 @@ else
fi

# Variables for use by fio.
export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_NIGHTLY}
export PERF_RANDSEED=${PERF_RANDSEED:-'1234'}
export PERF_COMPPERCENT=${PERF_COMPPERCENT:-'66'}
export PERF_COMPCHUNK=${PERF_COMPCHUNK:-'4096'}
export PERF_RUNTYPE=${PERF_RUNTYPE:-'nightly'}
export PERF_NTHREADS=1
export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'}
export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0'}
export PERF_IOSIZES=${PERF_IOSIZES:-'8k'}
export PERF_NUMIOS=655360 # 5GB worth of IOs

# Random writing to the file
# Random writing to the file
export NUMJOBS=$(get_max $PERF_NTHREADS)
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
export DIRECTORY=$(get_directory)
Expand All @@ -80,14 +75,12 @@ log_note "Collecting backend IO stats with lun list $lun_list"
# Run log collection for only 10 seconds which should be sufficient.
export PERF_RUNTIME=10
if is_linux; then
typeset perf_record_cmd="perf record --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"
export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/random_reads.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,14 @@ fill_zetta_cache 1800
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/random_readwrite.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,14 @@ fill_zetta_cache 1800
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,14 @@ fill_zetta_cache 1800
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/random_writes.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0 1'}
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/random_writes_zil.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,14 @@ export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'}
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/sequential_reads.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ fill_zetta_cache 1800
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch"
Expand All @@ -91,7 +88,7 @@ if is_linux; then
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ 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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch"
Expand All @@ -74,7 +71,7 @@ if is_linux; then
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ 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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch"
Expand All @@ -100,7 +97,7 @@ if is_linux; then
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ 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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch"
Expand All @@ -82,7 +79,7 @@ if is_linux; then
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/perf/regression/sequential_writes.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0 1'}
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 --call-graph dwarf,8192 -F 49 -agq \
-o /dev/stdout -- sleep ${PERF_RUNTIME}"

export collect_scripts=(
"zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
"vmstat -t 1" "vmstat"
"mpstat -P ALL 1" "mpstat"
"iostat -tdxyz 1" "iostat"
"arcstat 1" "arcstat"
"dstat -at --nocolor 1" "dstat"
"$perf_record_cmd" "perf"
"$PERF_RECORD_CMD" "perf"
)
else
export collect_scripts=(
Expand Down

0 comments on commit 96c1168

Please sign in to comment.