Add a couple of new microbenchmarks
authorMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 26 Sep 2011 08:21:30 +0000 (01:21 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 26 Sep 2011 08:21:30 +0000 (01:21 -0700)
cleaner/cleanbench.sh [new file with mode: 0755]
microbench/gb-write.sh [new file with mode: 0755]

diff --git a/cleaner/cleanbench.sh b/cleaner/cleanbench.sh
new file mode 100755 (executable)
index 0000000..2d0bf1d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Simple script to perform various random writes to files in a directory to
+# create a workload for the cleaner.
+
+NUM_FILES=8
+NUM_BLOCKS=16
+BLOCKSIZE=512K
+
+NUM_WRITES=128
+
+for n in $(seq 0 $(($NUM_FILES - 1))); do
+    [ -f file-$n ] || dd if=/dev/zero of=file-$n bs=$BLOCKSIZE count=$NUM_BLOCKS
+done
+
+for i in $(seq $NUM_WRITES); do
+    f=$(($RANDOM % $NUM_FILES))
+    b=$(($RANDOM % $NUM_BLOCKS))
+    echo "Write $i: file $f block $b"
+    dd if=/dev/zero of=file-$f bs=$BLOCKSIZE count=1 seek=$b conv=notrunc
+    sleep 2
+done
diff --git a/microbench/gb-write.sh b/microbench/gb-write.sh
new file mode 100755 (executable)
index 0000000..33bdca2
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+for i in $(seq $1); do
+    for j in $(seq 8); do
+        dd if=/dev/zero of=block-$i-$j bs=1M count=128 conv=fsync
+    done
+done