Makefile: Print timing information in test output.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 17 Nov 2009 23:28:27 +0000 (23:28 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 17 Nov 2009 23:28:27 +0000 (23:28 +0000)
For some reason, C makes a very poor showing in the timings.  I'd love
to know why.  (Guess at `malloc' being a bottleneck.)

Makefile

index aac2437..8ea4f74 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,23 +24,25 @@ clean::; rm -f $(CLEANFILES)
 
 CLEANFILES             += test.*
 test:: all
 
 CLEANFILES             += test.*
 test:: all
-       @win=0 lose=0;                                  \
-       for lang in $(LANGS); do                        \
-         echo >&3 "*** $$lang";                        \
-         printf "Test $$lang...";                      \
-         if ./test ./$${lang}-fringe 2>&3; then        \
-           win=$$(expr $$win + 1);                     \
-           printf " ok\n";                             \
-         else                                          \
-           lose=$$(expr $$lose + 1);                   \
-           printf " FAILED\n";                         \
-         fi;                                           \
-       done 3>test.log;                                \
-       if [ $$lose -eq 0 ]; then                       \
-         echo "All $$win test(s) OK";                  \
-       else                                            \
-         echo "FAILED $$lose test(s)!";                \
-         exit 1;                                       \
+       @win=0 lose=0;                                                  \
+       for lang in $(LANGS); do                                        \
+         echo >&3 "*** $$lang";                                        \
+         printf "Test $$lang...";                                      \
+         time=`command time -o/dev/stdout -f "%U user; %S system; %E"  \
+               ./test ./$${lang}-fringe 2>&3`;                         \
+         if [ $$? -eq 0 ]; then                                        \
+           win=$$(expr $$win + 1);                                     \
+           printf " ok ($$time)\n";                                    \
+         else                                                          \
+           lose=$$(expr $$lose + 1);                                   \
+           printf " FAILED\n";                                         \
+         fi;                                                           \
+       done 3>test.log;                                                \
+       if [ $$lose -eq 0 ]; then                                       \
+         echo "All $$win test(s) OK";                                  \
+       else                                                            \
+         echo "FAILED $$lose test(s)!";                                \
+         exit 1;                                                       \
        fi
 
 ###--------------------------------------------------------------------------
        fi
 
 ###--------------------------------------------------------------------------