1# #-- speed_cache.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8. ../common.sh 9 10# make tool 11get_make 12(cd $PRE; $MAKE perf) 13 14get_gcc 15$CC -o makeqs makeqs.c 16if test $? -ne 0; then 17 echo "could not compile makeqs" 18 exit 1 19fi 20 21./makeqs 10 > q10.txt 22cat q10.txt 23./makeqs 100 > q100.txt 24./makeqs 1000 > q1000.txt 25./makeqs 10000 > q10000.txt 26#./makeqs 100000 > q100000.txt 27#./makeqs 1000000 > q1000000.txt 28#./makeqs 10000000 > q10000000.txt 29 30# seconds per test 31dur=1 32 33# do the test 34echo "> perf test ldns-testns" 35$PRE/perf -d $dur -a "www.example.com IN A" 127.0.0.1@$FWD_PORT 2>&1 | tee outfile 36 37echo "> perf test cache-1" 38$PRE/perf -d $dur -a "www.example.com IN A" 127.0.0.1@$UNBOUND_PORT 2>&1 | tee outfile 39echo -n "cache-size-1 " >> ../.perfstats.txt 40grep "average qps" outfile >> ../.perfstats.txt 41 42# with $1=number $2=pretty-str $3=queryfile 43function perfnum() { 44 echo "" 45 echo "> perf test $1 $2" 46 $PRE/perf -d $dur -f $3 127.0.0.1@$UNBOUND_PORT 2>&1 | tee outfile 47 if test -n "$2"; then 48 echo -n "$2 " >> ../.perfstats.txt 49 grep "average qps" outfile >> ../.perfstats.txt 50 fi 51} 52 53function perftns() { 54 echo "" 55 echo "> perf testns $1 $2" 56 $PRE/perf -d $dur -f $3 127.0.0.1@$FWD_PORT 2>&1 | tee outfile 57} 58 59#perfnum 10 "" q10.txt 60perfnum 100 "cache-suffices" q100.txt 61#perfnum 1000 "" q1000.txt 62perfnum 10000 "cache-toosmall" q10000.txt 63#perfnum 100000 "100k" q100000.txt 64#perfnum 1000000 "1m" q1000000.txt 65#perfnum 1000000 "10m" q10000000.txt 66 67#perftns 10 "10" q10.txt 68#perftns 100 "100" q100.txt 69perftns 1000 "1k" q1000.txt 70#perftns 10000 "10k" q10000.txt 71#perftns 100000 "100k" q100000.txt 72#perftns 1000000 "1m" q1000000.txt 73#perftns 1000000 "10m" q10000000.txt 74 75echo "> cat logfiles" 76cat fwd.log 77cat unbound.log 78rm -f q*.txt 79exit 0 80