1
0
Fork 0

Generic performance test output

Styled for display to user as the tests are running, but data are written to
perf.out for additional processing.

You can style the perf.out file cleanly using:
  $ column -ts\| perf.out
newmaster
Mike Gerwitz 2014-03-29 11:16:14 -04:00
parent 58ee52ad4a
commit e85a7653e8
5 changed files with 47 additions and 9 deletions

4
.gitignore vendored
View File

@ -10,6 +10,7 @@ ChangeLog
# autotools- and configure-generated # autotools- and configure-generated
test/runner test/runner
test/perf/runner
aclocal.m4 aclocal.m4
Makefile.in Makefile.in
Makefile Makefile
@ -17,6 +18,9 @@ Makefile
configure configure
config.* config.*
# script output
perf.out
# should be added using autoreconf -i # should be added using autoreconf -i
INSTALL INSTALL
tools/install-sh tools/install-sh

View File

@ -112,10 +112,9 @@ test: check
check: $(src_tests) test-suite check: $(src_tests) test-suite
# performance tests # performance tests
perf: @PERF_TESTS@ perf:
perf-%.js: FORCE
if HAS_NODE if HAS_NODE
@$(NODE) $@ @$(path_test)/perf/runner @PERF_TESTS@
else else
@echo "Node.js must be installed in order to run performance tests" @echo "Node.js must be installed in order to run performance tests"
@exit 1 @exit 1

View File

@ -87,7 +87,8 @@ PERF_TESTS=$( find test/perf -name 'perf-*.js' | tr '\n' ' ' )
AC_SUBST(PERF_TESTS) AC_SUBST(PERF_TESTS)
AS_IF([test "$PERF_TESTS"], [AC_MSG_RESULT(ok)], [AC_MSG_WARN(none found)]) AS_IF([test "$PERF_TESTS"], [AC_MSG_RESULT(ok)], [AC_MSG_WARN(none found)])
AC_CONFIG_FILES( AC_CONFIG_FILES([Makefile doc/Makefile package.json lib/version.js])
[Makefile doc/Makefile package.json lib/version.js test/runner], AC_CONFIG_FILES([test/runner], [chmod +x test/runner])
[chmod +x test/runner]) AC_CONFIG_FILES([test/perf/runner], [chmod +x test/perf/runner])
AC_OUTPUT AC_OUTPUT

View File

@ -89,8 +89,6 @@ exports.report = function( count, desc )
pers = ( total / count ).toFixed( 10 ) pers = ( total / count ).toFixed( 10 )
; ;
console.log( total + "s (x" + count + " = " + pers + "s each)" + console.log( "%s|%s|%s|%s", desc, count, pers, total );
( ( desc ) ? ( ': ' + desc ) : '' )
);
}; };

View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# 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 <http://www.gnu.org/licenses/>.
#
# If you want formatted output, see :/tools/perf2html, or run this command:
# $ column -ts\| perf.out
# #
rawout=perf.out
>"$rawout"
for f in "$@"; do
@NODE@ "$f" || exit $?
done \
| tee -a "$rawout" \
| awk -F\| '
# format for display as the tests are running
{ printf "%s (x%s = %ss each): %s\n", $4, $2, $3, $1 }
'
echo "Raw data written to $rawout" >&2