Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #!/bin/sh
2 #
3 # multest
4 #
5 # Run multiply and square timing tests, to compute a chart for the
6 # current processor and compiler combination.
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 ECHO=/bin/echo
13 MAKE=gmake
15 $ECHO "\n** Running multiply and square timing tests\n"
17 $ECHO "Bringing 'mulsqr' up to date ... "
18 if $MAKE mulsqr ; then
19 :
20 else
21 $ECHO "\nMake failed to build mulsqr.\n"
22 exit 1
23 fi
25 if [ ! -x ./mulsqr ] ; then
26 $ECHO "\nCannot find 'mulsqr' program, testing cannot continue.\n"
27 exit 1
28 fi
30 sizes='64 128 192 256 320 384 448 512 640 768 896 1024 1536 2048'
31 ntests=500000
33 $ECHO "Running timing tests, please wait ... "
35 trap 'echo "oop!";rm -f tt*.tmp;exit 0' INT HUP
37 touch tt$$.tmp
38 $ECHO $ntests tests >> tt$$.tmp
39 for size in $sizes ; do
40 $ECHO "$size bits ... \c"
41 set -A res `./mulsqr $ntests $size|head -3|tr -d '%'|awk '{print $2}'`
42 $ECHO $size"\t"${res[0]}"\t"${res[1]}"\t"${res[2]} >> tt$$.tmp
43 $ECHO "(done)"
44 done
45 mv tt$$.tmp mulsqr-results.txt
46 rm -f tt$$.tmp
48 $ECHO "\n** Running Karatsuba-Ofman multiplication tests\n"
50 $ECHO "Brining 'karatsuba' up to date ... "
51 if $MAKE karatsuba ; then
52 :
53 else
54 $ECHO "\nMake failed to build karatsuba.\n"
55 exit 1
56 fi
58 if [ ! -x ./karatsuba ] ; then
59 $ECHO "\nCannot find 'karatsuba' program, testing cannot continue.\n"
60 exit 1
61 fi
63 ntests=100000
65 trap 'echo "oop!";rm -f tt*.tmp;exit 0' INT HUP
67 touch tt$$.tmp
68 for size in $sizes ; do
69 $ECHO "$size bits ... "
70 ./karatsuba $ntests $size >> tt$$.tmp
71 tail -2 tt$$.tmp
72 done
73 mv tt$$.tmp karatsuba-results.txt
74 rm -f tt$$.tmp
76 exit 0