aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-24 14:52:09 +0200
committerJakob Unterwurzacher2020-05-24 15:30:14 +0200
commit11dfcfd6c01500aa2c9fd50857fd70cd66a96e69 (patch)
tree55992d85b99813bf42565cc2b2c9067aee4eec3a /contrib
parent25f1727de9e5681a5ceefe1516a5a01fa4ca624a (diff)
contrib: add sshfs-benchmark.bash
Let's get some reproducible numbers for https://github.com/rfjakob/gocryptfs/issues/481 and https://github.com/rfjakob/gocryptfs/issues/410 Example run: $ ./sshfs-benchmark.bash nuetzlich.net working directory: /tmp/sshfs-benchmark.bash.vu4 sshfs mounted: nuetzlich.net:/tmp -> sshfs.mnt gocryptfs mounted: sshfs.mnt/sshfs-benchmark.bash.KM9/gocryptfs.crypt -> gocryptfs.mnt sshfs gocryptfs-on-sshfs git init 1.68 11.23 rsync 6.07 20.35
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/sshfs-benchmark.bash53
1 files changed, 53 insertions, 0 deletions
diff --git a/contrib/sshfs-benchmark.bash b/contrib/sshfs-benchmark.bash
new file mode 100755
index 0000000..b3c9646
--- /dev/null
+++ b/contrib/sshfs-benchmark.bash
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+set -eu
+
+function cleanup {
+ fusermount -u -z gocryptfs.mnt || true
+ rm -Rf "$SSHFS_TMP"
+ fusermount -u -z sshfs.mnt
+ cd /
+ rm -Rf "$LOCAL_TMP"
+}
+
+function prepare_mounts {
+ LOCAL_TMP=$(mktemp -d -t "$MYNAME.XXX")
+ cd $LOCAL_TMP
+ echo "working directory: $PWD"
+ mkdir sshfs.mnt gocryptfs.mnt
+ sshfs $HOST:/tmp sshfs.mnt
+ echo "sshfs mounted: $HOST:/tmp -> sshfs.mnt"
+ trap cleanup EXIT
+ SSHFS_TMP=$(mktemp -d "sshfs.mnt/$MYNAME.XXX")
+ mkdir $SSHFS_TMP/gocryptfs.crypt
+ gocryptfs -q -init -extpass "echo test" -scryptn=10 $SSHFS_TMP/gocryptfs.crypt
+ gocryptfs -q -extpass "echo test" $SSHFS_TMP/gocryptfs.crypt gocryptfs.mnt
+ echo "gocryptfs mounted: $SSHFS_TMP/gocryptfs.crypt -> gocryptfs.mnt"
+}
+
+function etime {
+ T=$(/usr/bin/time -f %e -o /dev/stdout "$@")
+ printf %20.2f "$T"
+}
+
+MYNAME=$(basename "$0")
+HOST=$1
+
+prepare_mounts
+
+# Make the bash builtin "time" print out only the elapsed wall clock
+# seconds
+TIMEFORMAT=%R
+
+echo
+echo "$MYNAME: sshfs gocryptfs-on-sshfs"
+echo -n "git init "
+etime git init -q sshfs.mnt/git1
+etime git init -q gocryptfs.mnt/git1
+echo
+
+git init -q git2
+echo -n "rsync "
+etime rsync -a --no-group git2 sshfs.mnt
+etime rsync -a --no-group git2 gocryptfs.mnt
+echo