aboutsummaryrefslogtreecommitdiff
path: root/profiling
diff options
context:
space:
mode:
Diffstat (limited to 'profiling')
-rwxr-xr-xprofiling/ls.bash4
-rwxr-xr-xprofiling/streaming-read.bash4
-rwxr-xr-xprofiling/streaming-write.bash4
-rwxr-xr-xprofiling/tar-extract.bash4
-rwxr-xr-xprofiling/tinyfiles.bash33
-rwxr-xr-xprofiling/write-trace.bash4
6 files changed, 48 insertions, 5 deletions
diff --git a/profiling/ls.bash b/profiling/ls.bash
index 35f5a39..334d8be 100755
--- a/profiling/ls.bash
+++ b/profiling/ls.bash
@@ -1,4 +1,6 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
+
+set -eu
cd "$(dirname "$0")"
diff --git a/profiling/streaming-read.bash b/profiling/streaming-read.bash
index 86ef942..138148c 100755
--- a/profiling/streaming-read.bash
+++ b/profiling/streaming-read.bash
@@ -1,4 +1,6 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
+
+set -eu
cd "$(dirname "$0")"
diff --git a/profiling/streaming-write.bash b/profiling/streaming-write.bash
index 6f3af56..3c29ee6 100755
--- a/profiling/streaming-write.bash
+++ b/profiling/streaming-write.bash
@@ -1,4 +1,6 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
+
+set -eu
cd "$(dirname "$0")"
diff --git a/profiling/tar-extract.bash b/profiling/tar-extract.bash
index f176368..e98100a 100755
--- a/profiling/tar-extract.bash
+++ b/profiling/tar-extract.bash
@@ -1,4 +1,6 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
+
+set -eu
cd "$(dirname "$0")"
diff --git a/profiling/tinyfiles.bash b/profiling/tinyfiles.bash
new file mode 100755
index 0000000..90820de
--- /dev/null
+++ b/profiling/tinyfiles.bash
@@ -0,0 +1,33 @@
+#!/bin/bash -eu
+#
+# Create a tarball of 100k 1-byte files using reverse mode
+# https://github.com/rfjakob/gocryptfs/issues/965
+
+cd "$(dirname "$0")"
+
+T=$(mktemp -d)
+mkdir "$T/a" "$T/b"
+
+../gocryptfs -init -reverse -quiet -scryptn 10 -extpass "echo test" "$@" "$T/a"
+
+# Cleanup trap
+# shellcheck disable=SC2064
+trap "cd /; fusermount -u -z '$T/b'; rm -Rf '$T/a'" EXIT
+
+echo "Creating 100k 1-byte files"
+SECONDS=0
+dd if=/dev/urandom bs=100k count=1 status=none | split --suffix-length=10 -b 1 - "$T/a/tinyfile."
+echo "done, $SECONDS seconds"
+
+../gocryptfs -reverse -quiet -nosyslog -extpass "echo test" \
+ -cpuprofile "$T/cprof" -memprofile "$T/mprof" \
+ "$@" "$T/a" "$T/b"
+
+echo "Running tar under profiler..."
+SECONDS=0
+tar -cf /dev/null "$T/b"
+echo "done, $SECONDS seconds"
+
+echo
+echo "Hint: go tool pprof ../gocryptfs $T/cprof"
+echo " go tool pprof -alloc_space ../gocryptfs $T/mprof"
diff --git a/profiling/write-trace.bash b/profiling/write-trace.bash
index 31af492..8b7cec9 100755
--- a/profiling/write-trace.bash
+++ b/profiling/write-trace.bash
@@ -1,8 +1,10 @@
-#!/bin/bash -eu
+#!/usr/bin/env bash
#
# Write an execution trace of writing 100MB of data
# to a new gocryptfs mount on /tmp
+set -eu
+
cd "$(dirname "$0")"
T=$(mktemp -d)