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