010270505fadccd63b0852a70fa7ee84ba6d0553
[bluesky.git] / microbench / setup / prepare-benchmark
1 #!/bin/bash
2 #
3 # Prepare a file system for a benchmark run by creating any needed files or
4 # directories.
5
6
7 # Defaults
8 SERVER=c09-45.sysnet.ucsd.edu
9 MNTDIR=/mnt/bluesky
10
11 BENCH_FILESIZE=$((1 << 12))
12 BENCH_FILECOUNT=$((8))
13 BENCH_WRITERATIO=1.0
14 BENCH_THREADS=8
15 BENCH_DURATION=120
16 BENCH_OPS=100
17 BENCH_INTERVALS=4
18
19 # Export any environment variables specified on the command line
20 for e in "$@"; do
21     echo "$e" 1>&2
22     if echo "$e" | grep = >/dev/null; then
23         eval "$e"
24         export ${e%=*}
25     fi
26 done
27
28 # Prepare to run the benchmark
29 mount -t nfs -o vers=3,tcp,rw,soft,intr $SERVER:/export $MNTDIR
30
31 pushd $MNTDIR >/dev/null
32
33 for t in $(seq 0 $(($BENCH_THREADS - 1))); do
34     mkdir t$t
35     for i in $(seq 0 $(($BENCH_FILECOUNT - 1))); do
36         dd if=/dev/zero of=t$t/$i bs=$BENCH_FILESIZE count=1
37     done
38 done
39
40 popd >/dev/null
41
42 umount -f $MNTDIR