Mercurial > octave
changeset 32899:4d24afc1d32b stable
include timing info in test suite result summary output
* __run_test_suite__.m (__run_test_suite__): Collect CPU and
wall-clock time for each test. Print header for column of CPU and
wall-clock times.
(print_pass_fail): New arguments, cpu_tm and clock_tm. Set to 0 if
only argument is a struct. If at least one is non-zero, display
timing info in summary ouput.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 01 Feb 2024 13:28:20 -0500 |
parents | 82b67791bf1b |
children | af3d1dec5e5d a575aa730d84 |
files | scripts/testfun/__run_test_suite__.m |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/__run_test_suite__.m Thu Feb 01 01:15:15 2024 -0500 +++ b/scripts/testfun/__run_test_suite__.m Thu Feb 01 13:28:20 2024 -0500 @@ -70,6 +70,7 @@ endif test ("", "explain", fid); puts ("\nIntegrated test scripts:\n\n"); + printf ("%101s\n", "[ CPU / CLOCK ]"); for i = 1:length (fcndirs) [p, n, xf, xb, sk, rtsk, rgrs] = run_test_dir (fid, fcndirs{i}, false); dp += p; @@ -213,8 +214,12 @@ if (has_tests (ffnm)) tmp = reduce_test_file_name (ffnm, topbuilddir, topsrcdir); print_test_file_name (tmp); + cpu_tm = cputime (); + tic (); [p, n, xf, xb, sk, rtsk, rgrs] = test (ffnm, "quiet", fid); - print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs); + clock_tm = toc (); + cpu_tm = cputime () - cpu_tm; + print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs, cpu_tm, clock_tm); dp += p; dn += n; dxf += xf; @@ -256,11 +261,11 @@ endfunction -function fail_info = print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs) +function fail_info = print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs, cpu_tm, clock_tm) if (nargin == 1) ## The summary info struct just contains info about failures, not - ## skipped tests. + ## skipped tests or timings. info = p; p = info.pass; n = info.ntst; @@ -269,10 +274,15 @@ sk = 0; rtsk = 0; rgrs = info.rgrs; + cpu_tm = 0; + clock_tm = 0; endif if ((n + sk + rtsk + rgrs) > 0) printf (" pass %4d/%-4d", p, n); + if (cpu_tm != 0 || clock_tm != 0) + printf (" [%6.3fs / %6.3fs]", cpu_tm, clock_tm); + endif nfail = n - p - xf - xb - rgrs; if (nfail > 0) printf ("\n%72s %3d", "FAIL ", nfail);