Skip to content

Instantly share code, notes, and snippets.

@riuvshin
Created February 12, 2018 10:53
Show Gist options
  • Save riuvshin/0a62a1ce803b7d95babeee3125df25da to your computer and use it in GitHub Desktop.
Save riuvshin/0a62a1ce803b7d95babeee3125df25da to your computer and use it in GitHub Desktop.
test_io_write() {
echo "running $FUNCNAME, write 1g file, iterations: $ITERATIONS"
local TIME_SUM=0
local SPEED_SUM=0
for i in $(seq 1 $ITERATIONS); do
rm -rf $VOLUME/largefile_write
result=$(dd if=/dev/zero of=$VOLUME/largefile_write bs=1M count=1000 2>&1)
echo "1 $result"
local TIME=$(echo $result | cut -d ' ' -f 12)
echo "2 $TIME"
local SPEED=$(echo $result | cut -d ' ' -f 14)
echo "3 $SPEED"
local TIME_SUM=$(echo $TIME_SUM + $TIME | bc)
echo "4 $TIME_SUM"
local SPEED_SUM=$(echo $SPEED_SUM + $SPEED | bc)
echo "4 $SPEED_SUM"
rm -rf $VOLUME/largefile_write
done
echo "AVG write speed (1G file):"
echo "$(echo "scale=2; $SPEED_SUM/$ITERATIONS" | bc) $(echo $result | cut -d ' ' -f 15) / in $(echo "scale=2; $TIME_SUM/$ITERATIONS" | bc) sec"
echo "=============================================================="
}
test_io_write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment