|
@@ -0,0 +1,102 @@
|
|
1
|
+--- a/testing/timeit.sh
|
|
2
|
++++ b/testing/timeit.sh
|
|
3
|
+@@ -1,11 +1,8 @@
|
|
4
|
+ #!/bin/bash
|
|
5
|
+
|
|
6
|
+-# "man 1 time" for details
|
|
7
|
+-export TIME="%U seconds"
|
|
8
|
+-
|
|
9
|
+ add()
|
|
10
|
+ {
|
|
11
|
+- if ! dc -e ""; then
|
|
12
|
++ if ! dc p >/dev/null 2>&1; then
|
|
13
|
+ echo you do not have dc, so I cannot add these numbers...
|
|
14
|
+ exit 1
|
|
15
|
+ fi
|
|
16
|
+@@ -14,7 +11,7 @@ add()
|
|
17
|
+ tot=0
|
|
18
|
+
|
|
19
|
+ while read n; do
|
|
20
|
+- tot=`dc -e "$n $tot + pop" 2> /dev/null`
|
|
21
|
++ tot=`dc $n $tot + p 2> /dev/null`
|
|
22
|
+ done
|
|
23
|
+
|
|
24
|
+ echo $tot seconds
|
|
25
|
+@@ -34,7 +31,7 @@ extract()
|
|
26
|
+
|
|
27
|
+ if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
|
|
28
|
+ echo
|
|
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]
|
|
31
|
+ echo
|
|
32
|
+ echo \"kernel\" uses the kernel pattern and library
|
|
33
|
+ echo \"userspace\" uses userspace pattern and library
|
|
34
|
+@@ -72,12 +69,12 @@ echo Timing $1
|
|
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
|
|
41
|
+ exit 1
|
|
42
|
+ fi
|
|
43
|
+ else
|
|
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
|
|
47
|
+ exit 1
|
|
48
|
+ fi
|
|
49
|
+@@ -85,12 +82,12 @@ if [ $3 == "all" ]; then
|
|
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
|
|
56
|
+ exit 1
|
|
57
|
+ fi
|
|
58
|
+ else
|
|
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
|
|
62
|
+ exit 1
|
|
63
|
+ fi
|
|
64
|
+@@ -107,12 +104,12 @@ elif [ $3 == "real" ]; then
|
|
65
|
+ printf $f\\t
|
|
66
|
+ #echo `extract $1`
|
|
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
|
|
71
|
+ exit 1
|
|
72
|
+ fi
|
|
73
|
+ else
|
|
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
|
|
77
|
+ exit 1
|
|
78
|
+ fi
|
|
79
|
+@@ -123,12 +120,12 @@ elif [ $3 == "real" ]; then
|
|
80
|
+ for f in data/*; do
|
|
81
|
+ printf $f\\t
|
|
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
|
|
86
|
+ exit 1
|
|
87
|
+ fi
|
|
88
|
+ else
|
|
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
|
|
92
|
+ exit 1
|
|
93
|
+ fi
|
|
94
|
+@@ -137,7 +134,7 @@ elif [ $3 == "real" ]; then
|
|
95
|
+ fi
|
|
96
|
+
|
|
97
|
+ printf Total:\
|
|
98
|
+- cat tmp.$$ | cut -d\ -f 2 | add
|
|
99
|
++ cat tmp.$$ | cut -ds -f 1| add
|
|
100
|
+
|
|
101
|
+ rm tmp.$$
|
|
102
|
+ else
|