1 Index: l7-protocols-2007-10-10/testing/timeit.sh
2 ===================================================================
3 --- l7-protocols-2007-10-10.orig/testing/timeit.sh 2007-10-31 15:58:48.000000000 -0500
4 +++ l7-protocols-2007-10-10/testing/timeit.sh 2007-10-31 16:02:19.000000000 -0500
8 -# "man 1 time" for details
9 -export TIME="%U seconds"
14 + if ! dc p >/dev/null 2>&1; then
15 echo you do not have dc, so I cannot add these numbers...
22 - tot=`dc -e "$n $tot + pop" 2> /dev/null`
23 + tot=`dc $n $tot + p 2> /dev/null`
29 if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
31 - echo Syntax: ./timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
32 + echo Syntax: .//usr/bin/timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
34 echo \"kernel\" uses the kernel pattern and library
35 echo \"userspace\" uses userspace pattern and library
37 if [ $3 == "all" ]; then
38 echo Using all characters
39 if [ $2 == "kernel" ]; then
40 - if ! ./randchars | time $speedprog "`extract $1`" verbose; then
41 + if ! ./randchars | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
42 echo $speedprog failed. > /dev/stderr
46 - if ! ./randchars | time $speedprog -f "$1" -v; then
47 + if ! ./randchars | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
48 echo $speedprog failed. > /dev/stderr
52 elif [ $3 == "print" ]; then
53 echo Using only printable characters
54 if [ $2 == "kernel" ]; then
55 - if ! ./randprintable | time $speedprog "`extract $1`" verbose; then
56 + if ! ./randprintable | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
57 echo $speedprog failed. > /dev/stderr
61 - if ! ./randprintable | time $speedprog -f "$1" -v; then
62 + if ! ./randprintable | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
63 echo $speedprog failed. > /dev/stderr
69 if [ $2 == "kernel" ]; then
70 - if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
71 + if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
72 echo $speedprog failed. > /dev/stderr
76 - if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
77 + if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
78 echo $speedprog failed. > /dev/stderr
84 if [ $2 == "kernel" ]; then
85 - if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
86 + if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
87 echo $speedprog failed. > /dev/stderr
91 - if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
92 + if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
93 echo $speedprog failed. > /dev/stderr
100 - cat tmp.$$ | cut -d\ -f 2 | add
101 + cat tmp.$$ | cut -ds -f 1| add