1 --- a/testing/timeit.sh
2 +++ b/testing/timeit.sh
6 -# "man 1 time" for details
7 -export TIME="%U seconds"
12 + if ! dc p >/dev/null 2>&1; then
13 echo you do not have dc, so I cannot add these numbers...
20 - tot=`dc -e "$n $tot + pop" 2> /dev/null`
21 + tot=`dc $n $tot + p 2> /dev/null`
27 if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
29 - echo Syntax: ./timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
30 + echo Syntax: .//usr/bin/timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
32 echo \"kernel\" uses the kernel pattern and library
33 echo \"userspace\" uses userspace pattern and library
35 if [ $3 == "all" ]; then
36 echo Using all characters
37 if [ $2 == "kernel" ]; then
38 - if ! ./randchars | time $speedprog "`extract $1`" verbose; then
39 + if ! ./randchars | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
40 echo $speedprog failed. > /dev/stderr
44 - if ! ./randchars | time $speedprog -f "$1" -v; then
45 + if ! ./randchars | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
46 echo $speedprog failed. > /dev/stderr
50 elif [ $3 == "print" ]; then
51 echo Using only printable characters
52 if [ $2 == "kernel" ]; then
53 - if ! ./randprintable | time $speedprog "`extract $1`" verbose; then
54 + if ! ./randprintable | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
55 echo $speedprog failed. > /dev/stderr
59 - if ! ./randprintable | time $speedprog -f "$1" -v; then
60 + if ! ./randprintable | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
61 echo $speedprog failed. > /dev/stderr
67 if [ $2 == "kernel" ]; then
68 - if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
69 + if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
70 echo $speedprog failed. > /dev/stderr
74 - if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
75 + if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
76 echo $speedprog failed. > /dev/stderr
82 if [ $2 == "kernel" ]; then
83 - if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
84 + if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
85 echo $speedprog failed. > /dev/stderr
89 - if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
90 + if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
91 echo $speedprog failed. > /dev/stderr
98 - cat tmp.$$ | cut -d\ -f 2 | add
99 + cat tmp.$$ | cut -ds -f 1| add