2006-08-19 Aaron Bockover <abockover@novell.com>
authorAaron Bockover <abockover@novell.com>
Sat, 19 Aug 2006 21:02:25 +0000 (21:02 -0000)
committerAaron Bockover <abockover@novell.com>
Sat, 19 Aug 2006 21:02:25 +0000 (21:02 -0000)
    * test/driver.c: added -n mode to show only raw global run times,
    which is useful for scripts (test-both --speed-compare)

    * test/test-both: added --speed-compare mode

    * test/README: updated with information on --speed-compare

svn path=/trunk/mono/; revision=64055

eglib/ChangeLog
eglib/test/README
eglib/test/driver.c
eglib/test/test-both

index 3d5aaac567793834b4a0fdba59197e92ed8dd79e..fb3bf118cef84cead6d388bf445c71b64f66775d 100644 (file)
@@ -1,3 +1,12 @@
+2006-08-19  Aaron Bockover  <abockover@novell.com>
+
+       * test/driver.c: added -n mode to show only raw global run times,
+       which is useful for scripts (test-both --speed-compare)
+
+       * test/test-both: added --speed-compare mode
+
+       * test/README: updated with information on --speed-compare
+
 2006-08-19  Aaron Bockover  <abockover@novell.com>
 
        * test/test.c: do not print times if -t is not passed
index 61eed46dc779b9ca9f993b87772d95bb3ab2c243..7c28d03e95420165123c0fc33577df49604b6dd7 100644 (file)
@@ -92,7 +92,22 @@ Example: show test output of all available groups
 The 'test-both' script can be used to run both test-eglib and test-glib
 with the same options back to back:
 
-       $./test-both -tqi 100000 ptrarray
+       $ ./test-both -tqi 100000 ptrarray
        EGlib Total Time: 1.1961s
        GLib Total Time: 0.955957s
 
+test-both also has a nice --speed-compare mode that shows comparison
+information about EGlib vs GLib. It can run all tests or specific tests
+with a configurable number of iterations. --speed-compare mode always runs
+the drivers with -qtni
+
+The syntax for --speed-compare is:
+
+       ./test-both --speed-compare [ITERATIONS] [GROUPS...]
+
+       $ ./test-both --speed-compare       Runs all tests with default iterations
+       $ ./test-both --speed-compare 500   Runs all tests with 500 iterations
+       $ ./test-both --speed-compare ptrarray   Runs ptrarray test with default
+                                                iterations
+
+
index 2319be28570a771a42f5d22467b16ccbf71dc42c..9bd3d80d31b6f9666472e826deb4f5e2c58ef46a 100644 (file)
@@ -74,7 +74,9 @@ static void print_help(char *s)
        printf("  -t, --time          time the tests\n");
        printf("  -i, --iterations    number of times to run tests\n");
        printf("  -q, --quiet         do not print test results; "
-               "time always prints\n\n");
+               "final time always prints\n");
+       printf("  -n                  print final time without labels, "
+               "nice for scripts\n\n");
        printf("TESTGROUPS available:\n");
 
        for(i = 0; test_groups[i].name != NULL; i++) {
@@ -92,6 +94,7 @@ gint main(gint argc, gchar **argv)
        gboolean report_time = FALSE;
        gboolean quiet = FALSE;
        gboolean global_failure = FALSE;
+       gboolean no_final_time_labels = FALSE;
        
        static struct option long_options [] = {
                {"help",       no_argument,       0, 'h'},
@@ -101,7 +104,7 @@ gint main(gint argc, gchar **argv)
                {0, 0, 0, 0}
        };
 
-       while((c = getopt_long(argc, argv, "htqi:", long_options, NULL)) != -1) {                       switch(c) {
+       while((c = getopt_long(argc, argv, "htqni:", long_options, NULL)) != -1) {                      switch(c) {
                        case 'h':
                                print_help(argv[0]);
                                return 1;
@@ -114,6 +117,9 @@ gint main(gint argc, gchar **argv)
                        case 'q':
                                quiet = TRUE;
                                break;
+                       case 'n':
+                               no_final_time_labels = TRUE;
+                               break;
                }
        }
 
@@ -158,7 +164,11 @@ gint main(gint argc, gchar **argv)
        
        if(report_time) {
                gdouble duration = get_timestamp() - time_start;
-               printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+               if(no_final_time_labels) {
+                       printf("%g\n", duration);
+               } else {
+                       printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+               }
        }
 
        if(tests_to_run != NULL) {
index a006a43fdf93b10510c0c321ae5cfd6b78dc2c69..fd3322d3a2bd51e6bb9a9df2b8d317a325a05370 100755 (executable)
@@ -1,5 +1,46 @@
 #!/bin/sh
 
+if [ "x$1" = "x--speed-compare" ]; then
+       ITERATIONS=100000
+       if [ ! -z "$2" ]; then
+               case $2 in
+                       *[0-9]*) ITERATIONS=$2; break;
+               esac
+       fi      
+
+       OPTIONS="-qnti $ITERATIONS"
+
+       for arg in $@; do
+               if [ "x$arg" = "x--speed-compare" ]; then       
+                       continue;
+               elif [ "$arg" = "$ITERATIONS" ]; then
+                       continue;
+               fi
+
+               OPTIONS="$OPTIONS $arg"
+       done
+       
+       echo "Running tests with $OPTIONS..."
+       
+       GLIB=`./test-glib $OPTIONS`
+       EGLIB=`./test-eglib $OPTIONS`
+
+       # this blows
+       FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
+       FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
+       SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
+       SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
+
+       FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
+
+       echo "$FASTER_NAME $FASTER_SPEED"
+       echo "$SLOWER_NAME $SLOWER_SPEED"
+       echo "------------------------------------------------"
+       echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
+       
+       exit 0;
+fi
+
 ./test-eglib $@
 ./test-glib $@