forked from hanwen/go-fuse
/
benchmark.sh
76 lines (50 loc) · 1.37 KB
/
benchmark.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# Runtime is typically dominated by the costs of GetAttr (ie. Stat),
# so let's time that. We use zipfs which runs from memory to minimize
# noise due to the filesystem itself.
if [ "$1" == "" ] ; then
echo "Usage: benchmark.sh ZIPFILE"
echo "The zipfile should be large (> 10000 files)."
exit 2
fi
set -eux
ZIPFILE=$1
shift
CPU_COUNT=$(grep '^processor' /proc/cpuinfo | wc -l)
export GOMAXPROCS=${CPU_COUNT}
DELAY=5
gomake -C zipfs
gomake -C bulkstat
MP=/tmp/zipbench
fusermount -u ${MP} || true
mkdir -p ${MP}
ZIPFS=$PWD/zipfs/zipfs
BULKSTAT="$PWD/bulkstat/bulkstat -threads ${CPU_COUNT}"
cd /tmp
${ZIPFS} ${MP} ${ZIPFILE} >& zipfs.log &
# Wait for FS to mount.
sleep ${DELAY}
find ${MP} > /tmp/zipfiles.txt
fusermount -u ${MP}
# Run vanilla: block box measurement.
${ZIPFS} ${MP} ${ZIPFILE} >& zipfs.log &
# Wait for zipfs to unpack and serve the file.
sleep ${DELAY}
# Performance number without 6prof running
echo -e "\n\n"
${BULKSTAT} -runs 5 /tmp/zipfiles.txt
echo -e "\n\n"
# Run 6prof
6prof -p $! -d 20 -t 3 -hs -l -h -f >& /tmp/zipfs.6prof &
sleep 0.1
# Feed data to 6prof
${BULKSTAT} -runs 3 /tmp/zipfiles.txt
echo -e "\n\n"
fusermount -u ${MP}
# Now run with internal monitoring.
${ZIPFS} -latencies ${MP} ${ZIPFILE} >& zipfs.log &
sleep ${DELAY}
# Measurements.
${BULKSTAT} -runs 5 /tmp/zipfiles.txt
# Dump internal measurements.
cat ${MP}/.debug/*