view m-toolbox/classes/tests/@ut_result_printer/printRuntimeString.m @ 42:f90d4f666cc7
database-connection-manager
Cleanup
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 18:04:34 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % PRINTRUNTIMESTRING returns a string listing the run time of the tests.
+ − %
+ − % VERSION: $Id: printRuntimeString.m,v 1.2 2010/10/26 12:18:33 hewitson Exp $
+ − %
+ − function res = printRuntimeString(varargin)
+ −
+ − urp = varargin{1};
+ − if nargin>1
+ − limit = varargin{2};
+ − else
+ − limit = inf;
+ − end
+ −
+ − % build array of runtimes
+ − runtimes = zeros(1,numel(urp.results));
+ − for kk=1:numel(urp.results)
+ − r = urp.results(kk);
+ − runtimes(kk) = r.runtime;
+ − end
+ −
+ − % sort array
+ − [y,idx] = sort(runtimes,'descend');
+ − results = urp.results(idx);
+ −
+ − res = sprintf('-------- Runtime ----------\n\n');
+ − for kk=1:numel(results)
+ − r = results(kk);
+ − res = [res sprintf('%0.3f s - %s/%s\n', r.runtime, r.testClass, r.testMethod)];
+ − if kk>limit
+ − break
+ − end
+ − end
+ − res = [res sprintf('\n\n----------------------------\n')];
+ − end