bench: enable HTML generation
authorJean Privat <jean@pryen.org>
Fri, 26 Jul 2013 16:36:50 +0000 (12:36 -0400)
committerJean Privat <jean@pryen.org>
Fri, 26 Jul 2013 16:36:50 +0000 (12:36 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

benchmarks/bench_engines.sh
benchmarks/bench_plot.sh

index 5e8716b..df4bba2 100755 (executable)
@@ -96,6 +96,9 @@ function skip_test()
        else
                return 0
        fi
+       if test -n "$html"; then
+               echo >>"$html" "<h2>$1</h2>"
+       fi
        echo "*"
        echo "* $1 *****"
        echo "*"
@@ -146,6 +149,7 @@ function usage()
        echo "  -n count: number of execution for each bar (default: $count)"
        echo "  --dry: Do not run the commands, just reuse the data and generate the graph"
        echo "  --fast: Run less and faster tests"
+       echo "  --html: Generate and HTML output"
        echo "  -h: this help"
 }
 
@@ -157,6 +161,7 @@ while [ "$stop" = false ]; do
                -n) count="$2"; shift; shift;;
                --dry) dry_run=true; shift;;
                --fast) fast=true; shift;;
+               --html) html="index.html"; echo >"$html" "<html><head></head><body>"; shift;;
                *) stop=true
        esac
 done
@@ -444,6 +449,10 @@ function bench_compilation_time
 }
 bench_compilation_time
 
+if test -n "$html"; then
+       echo >>"$html" "</body></html>"
+fi
+
 if test -n "$died"; then
        echo "Some commands failed"
        exit 1
index 405aa7e..e874308 100755 (executable)
@@ -62,6 +62,9 @@ function prepare_res()
 {
        echo
        echo "# [$2] $3 #"
+       if test -n "$html"; then
+               echo >>"$html" "<p>[$2] $3 <a href=\"$1\">data</a></p>"
+       fi
        res=$1
        if [ "$plots" = "" ]; then
                plots="plot '$1' using 4:2:3:xticlabels(5) ti '$2'"
@@ -91,9 +94,19 @@ set title "$1 ; avg. on $count-1 runs"
 set ylabel "time (s)"
 $plots
 END
+plots=
+
+if test -n "$html"; then
+       echo "# gnuplot $1"
+       bn=`basename "$1" .gnu`
+       gnuplot -e "set term png; set output \"$bn.png\"" "$1"
+       echo gnuplot -e "set term png; set output \"$bn.png\"" "$1"
+
+       echo >>"$html" "<img src=\"$bn.png\"/>"
+else
        echo "# gnuplot -p $1"
        gnuplot -p "$1"
-       plots=
+fi
 }
 
 ## GLOBAL VARIABLES ##
@@ -104,3 +117,5 @@ res=
 # The current stuff to plot (set by prepare_res, used by plot)
 plots=
 
+# The name of the html file if output is set to html
+html=