#!/bin/sh
# Execute sysbench fsync test to determine drive commit rate both
# with and without the drive's cache enabled
# Greg Smith greg@2ndQuadrant.com
DRIVE="/dev/sda"
PREFIX="$HOME/sysbench-0.4.10"

# Disable write cache
hdparm -W 0 $DRIVE
hdparm -W $DRIVE

echo fsync with write cache disabled, look for "Requests/sec"
$PREFIX/sysbench/sysbench --test=fileio --file-fsync-freq=1 --file-num=1 --file-total-size=16384 --file-test-mode=rndwr run

# Enable write cache (returning it to the usual default)
hdparm -W 1 $DRIVE
hdparm -W $DRIVE

echo fsync with write cache enabled, look for "Requests/sec"
$PREFIX/sysbench/sysbench --test=fileio --file-fsync-freq=1 --file-num=1 --file-total-size=16384 --file-test-mode=rndwr run
