-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·62 lines (55 loc) · 1.58 KB
/
run.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
#!/bin/bash
usage () {
echo "Generate rollsum stats from testdata.
Usage: $0 [-N] [-B <blocksize>] [-C <blockcount>] [<outdir>]
Where:
-N regenerate summary files only.
<blocksize> is the blocksize with optional K, or M suffix.
<blockcount> is the number of blocks to generate stats for.
<outdir> is the directory to write results to (default: .).
"
exit 1
}
OPTIONS=$(getopt 'NB:C:h?' "$@")
[ $? == 0 ] || usage
eval set -- "$OPTIONS"
BLOCKSIZE=1K
BLOCKCOUNT=10000
while true; do
case "$1" in
-N ) SKIPTESTS=1; shift ;;
-B ) BLOCKSIZE=$2; shift 2 ;;
-C ) BLOCKCOUNT=$2; shift 2 ;;
-h ) usage ;;
-- ) shift; break ;;
esac
done
OUTDIR=${1:-.}
rollsum () {
# rollsum <seed> <offs> <base> <map> <zip|cvs>
args="-C ${BLOCKCOUNT} -B ${BLOCKSIZE} --seed=$1 --offs=$2 --base=$3 --map=$4"
echo "doing ${args} <data/$5.dat"
./rollsum.py ${args} <data/$5.dat >${OUTDIR}/$5-${BLOCKSIZE}-$1-$2-$3-$4.txt
}
runtests () {
# runtests <src>
# Do librsync.
rollsum 0 31 0x10000 ord $1
# Do map=mul.
rollsum 1 0 0xffff mul $1
for base in 0x10000 0xffff 0xfff1; do
for map in ord pow; do
rollsum 1 0 ${base} ${map} $1
done
done
}
for src in csv zip; do
[ -z $SKIPTESTS ] && runtests ${src}
for s in 'rollsum' 's1sum' 's2sum' 'and_mask' 'mod_mask' 'mix_mask'; do
for f in ${OUTDIR}/${src}-${BLOCKSIZE}-*-*-*-*.txt; do
run=$(sed -n '/Results/ {s:Results for ::; p}' $f)
stats=$(sed -n "/^$s:/ {s:.* min/:min:; p}" $f)
echo ${run} ${stats}
done | sort -n -t/ -k6 > ${OUTDIR}/${src}-${BLOCKSIZE}-${s}-summary.txt
done
done