diff --git a/Makefile.am b/Makefile.am index d0b5796..3a4f291 100644 --- a/Makefile.am +++ b/Makefile.am @@ -111,7 +111,10 @@ html-single: test: check check: $(src_tests) test-suite -# performance tests +# performance tests (order matters here) +perf-html: perf.log.html +perf.%.html: perf.% + sort "$<" | $(path_tools)/perf2html -F\| > "$@" perf: perf.log perf.%: FORCE if HAS_NODE diff --git a/tools/perf2html b/tools/perf2html new file mode 100755 index 0000000..842bb72 --- /dev/null +++ b/tools/perf2html @@ -0,0 +1,97 @@ +#!/usr/bin/awk -f +# Renders performance test output +# +# Copyright (C) 2014 Mike Gerwitz +# +# This file is part of GNU ease.js. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# If you want more modest output, consider running this command instead: +# $ column -ts\| perf.out +# # + +function styleout( i ) { + value = $i + + # slow tests should reduce the number of iterations to eat up less time + if ( ( i == COL_TOTAL ) && ( value > 0.05 ) ) { + class = "slow" + if ( value > 0.1 ) + class = "very " class + + return "" value "" + } + else + return value +} + + +BEGIN { + # column constants + COL_DESC = 1 + COL_COUNT = 2 + COL_SINGLE = 3 + COL_TOTAL = 4 + + # running time tally + runtime = 0.00 + + # header + print "" \ + "" \ + "" \ + "GNU ease.js Performance Test Results" \ + "" \ + "" \ + "" \ + "

GNU ease.js Performance Test Results

" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" +} + +# format row of output (desc, count, time, total) +{ + runtime += $COL_TOTAL + + printf "" + for ( i = 1; i <= NF; i++ ) + { + printf "", styleout( i ) + } + printf "\n" +} + +END { + # footer + print "" \ + "
DescriptionIterationsSeconds/iterTotal (s)
%s
" \ + "

Total running time: " runtime " seconds

" \ + "" \ + "" +}