Add a couple of new microbenchmarks
[bluesky.git] / cleaner / cleanbench.sh
1 #!/bin/bash
2 #
3 # Simple script to perform various random writes to files in a directory to
4 # create a workload for the cleaner.
5
6 NUM_FILES=8
7 NUM_BLOCKS=16
8 BLOCKSIZE=512K
9
10 NUM_WRITES=128
11
12 for n in $(seq 0 $(($NUM_FILES - 1))); do
13     [ -f file-$n ] || dd if=/dev/zero of=file-$n bs=$BLOCKSIZE count=$NUM_BLOCKS
14 done
15
16 for i in $(seq $NUM_WRITES); do
17     f=$(($RANDOM % $NUM_FILES))
18     b=$(($RANDOM % $NUM_BLOCKS))
19     echo "Write $i: file $f block $b"
20     dd if=/dev/zero of=file-$f bs=$BLOCKSIZE count=1 seek=$b conv=notrunc
21     sleep 2
22 done