summaryrefslogtreecommitdiff
path: root/benchmark.sh
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-11-25 08:11:57 +0200
committerLars Wirzenius <liw@liw.fi>2020-11-25 10:37:38 +0200
commitaf2c79d1963c49402d5b47e916ffb6b0210c79d1 (patch)
treeeea17935c844844a6a4ca5620ee5dae4ede6ce14 /benchmark.sh
parent02684a9c68ffc87d20ba89852fbcba43ed521039 (diff)
downloadobnam2-af2c79d1963c49402d5b47e916ffb6b0210c79d1.tar.gz
feat: add programs to benchmark server chunk storage
Diffstat (limited to 'benchmark.sh')
-rwxr-xr-xbenchmark.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/benchmark.sh b/benchmark.sh
new file mode 100755
index 0000000..cf7491a
--- /dev/null
+++ b/benchmark.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -euo pipefail
+
+chunkdir="$1"
+bin="$2"
+
+cleanup()
+{
+ echo "emptying $chunkdir" 1>&2
+ find "$chunkdir" -mindepth 1 -delete
+}
+
+cleanup
+
+echo "running benchmarks for various sizes"
+for n in 1 10 100 1000 10000 100000 1000000
+do
+ echo "size $n" 1>&2
+ for prog in benchmark-null benchmark-index benchmark-store benchmark-indexedstore
+ do
+ /usr/bin/time --format "$prog $n %e" "$bin/$prog" "$chunkdir" "$n" 2>&1
+ cleanup
+ done
+done | awk '{ printf "%-30s %10s %10s\n", $1, $2, $3 }'