Skip to content

Instantly share code, notes, and snippets.

@kellabyte
Created June 18, 2014 14:15
Show Gist options
  • Save kellabyte/39f74076f29c4a9c4d85 to your computer and use it in GitHub Desktop.
Save kellabyte/39f74076f29c4a9c4d85 to your computer and use it in GitHub Desktop.
#!/bin/bash
function run {
NAME=$1
BENCHMARK=$2
RECORDS=$3
VALUE_SIZE=$4
CACHE_SIZE=$5
REUSE_DB=$6
BENCHMARK_NAME=${NAME}_${BENCHMARK}
DSTAT_PID=
export TEST_TMPDIR=/mnt
mkdir results
rm -rf results/${BENCHMARK_NAME}.csv
rm -rf /mnt/db*
sudo echo never > /sys/kernel/mm/transparent_hugepage/enabled
dstat -tcmrd --disk-util -ny --output results/${BENCHMARK_NAME}.csv > /dev/null &
DSTAT_PID=$!
./db_bench_${NAME} --stats_interval=1000 --num=$RECORDS --cache_size=$CACHE_SIZE --value_size=$VALUE_SIZE --benchmarks=$BENCHMARK --use_existing_db=$REUSE_DB > results/${BENCHMARK_NAME}.log 2>&1
sed -i.bak -e 's/^.*thread //' -e 's/:.*and (/^\t/' -e 's/,[0-9].*,/^\t/' -e 's/) sec.*$//' results/${BENCHMARK_NAME}.log
START=4
LINES=`sed -n '$=' results/${BENCHMARK_NAME}.log`
LINES=$(($LINES-10))
echo $LINES
`kill -9 $DSTAT_PID`
}
run leveldb fillrandsync 7500000 100 12344896000 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment