diff options
| author | Ankush Patel | 2026-02-14 03:41:23 +1300 |
|---|---|---|
| committer | Ankush Patel | 2026-02-14 03:41:23 +1300 |
| commit | 8d8fb15f0b3680add1f3b28c062b573a92221ab0 (patch) | |
| tree | fbd54302af652c38eb292167919125a8b57f5d2a /profiling | |
| parent | 903fc9d077a81d9224de4207d1672c0b1127cf42 (diff) | |
| parent | 5f5c34ac78cb9d1765ce9cabe87420c32f9d867e (diff) | |
Merge branch 'master' into freebsd-support
Diffstat (limited to 'profiling')
| -rwxr-xr-x | profiling/tinyfiles.bash | 33 |
1 files changed, 33 insertions, 0 deletions
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" |
