aboutsummaryrefslogtreecommitdiff
path: root/profiling/tar-extract.bash
blob: f17636832c899e9bad9c3a9a288f6299b4fe4028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash -eu

cd "$(dirname "$0")"

# Download /tmp/linux-3.0.tar.gz
../tests/dl-linux-tarball.bash

T=$(mktemp -d)
mkdir "$T/a" "$T/b"

set -x
../gocryptfs -init -quiet -scryptn 10 -extpass "echo test" "$@" "$T/a"
../gocryptfs -quiet -extpass "echo test" -cpuprofile "$T/cprof" -memprofile "$T/mprof" \
	"$@" "$T/a" "$T/b"
{ set +x ; } 2> /dev/null

# Cleanup trap
trap "cd /; fusermount -u -z $T/b; rm -Rf $T/a" EXIT

echo "Extracting..."
time tar xzf /tmp/linux-3.0.tar.gz -C "$T/b"

echo
echo "Hint: go tool pprof ../gocryptfs $T/cprof"
echo "      go tool pprof -alloc_space ../gocryptfs $T/mprof"