Skip to content

Instantly share code, notes, and snippets.

@teknoraver
Last active December 22, 2020 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teknoraver/b9272bf463e54c22e577b4e4684816f1 to your computer and use it in GitHub Desktop.
Save teknoraver/b9272bf463e54c22e577b4e4684816f1 to your computer and use it in GitHub Desktop.
#!/bin/sh
dev=/dev/nvme0n1p1
mnt=/media
run_one() {
echo "$2t"
fio \
--output="fio-$1-$2t.csv" --output-format=terse \
--directory="$mnt" \
--direct=1 \
--iodepth=$2 \
--name="random-write-$1-$2t" \
--ioengine=io_uring \
--rw=randwrite \
--bs=4k \
--size=16g \
--numjobs=$2 \
--runtime=60 --time_based --end_fsync=1
echo
rm -f "$mnt/"random-write-*
fstrim "$mnt"
sync
}
run_all() {
echo "Testing $1"
wipefs -fqa $dev
blkdiscard -f $dev
mkfs.$1 -q $dev
mount $dev "$mnt"
run_one $1 1
run_one $1 2
run_one $1 4
run_one $1 8
umount "$mnt"
}
run_all ext4
run_all xfs
run_all f2fs
#!/usr/bin/gnuplot
set terminal pngcairo size 800,600
png="fstest.png"
print "Saving to ",png
set output png
set xlabel 'threads'
set ylabel 'kIOPS'
set grid
set datafile separator comma
set key left
set key autotitle columnhead
colors='#0072bd #d95319 #77ac30'
plot "<./iopsget" using 1:($2/1000) with lines linecolor rgb word(colors, 1), \
'' using 1:($3/1000) with lines linecolor rgb word(colors, 2), \
'' using 1:($4/1000) with lines linecolor rgb word(colors, 3)
#!/bin/sh
echo ',EXT4,XFS,F2FS'
for t in 1 2 4 8; do
echo -n $t
for fs in ext4 xfs f2fs; do
awk -F';' '{iops+=$49}END{printf ","iops}' fio-$fs-${t}t.csv
done
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment