mirror of
https://github.com/Matir/skel.git
synced 2026-05-25 21:19:09 -07:00
32 lines
844 B
Bash
Executable File
32 lines
844 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ue
|
|
|
|
FILENAME=${1}
|
|
BENCHMARK_SIZE=${BENCHMARK_SIZE:-1000m}
|
|
|
|
if [ -f ${FILENAME} ] ; then
|
|
echo "File ${FILENAME} already exists!" >/dev/stderr
|
|
exit 1
|
|
fi
|
|
|
|
trap "test -f ${FILENAME} && rm -f ${FILENAME}" EXIT
|
|
|
|
IOENGINE="libaio"
|
|
DIRECT=1
|
|
if [ "$(uname)" = "Darwin" ]; then
|
|
IOENGINE="posixaio"
|
|
# macOS doesn't support O_DIRECT in the same way, but fio's direct=1
|
|
# handles it via F_NOCACHE if supported.
|
|
DIRECT=1
|
|
fi
|
|
|
|
fio --loops=5 --size=${BENCHMARK_SIZE} --filename=${FILENAME} \
|
|
--stonewall --ioengine=${IOENGINE} --direct=${DIRECT} \
|
|
--name=Seqread --bs=1m --rw=read \
|
|
--name=Seqwrite --bs=1m --rw=write \
|
|
--name=512Kread --bs=512k --rw=randread \
|
|
--name=512Kwrite --bs=512k --rw=randwrite \
|
|
--name=4kQD32read --bs=4k --iodepth=32 --rw=randread \
|
|
--name=4kQD32write --bs=4k --iodepth=32 --rw=randwrite
|