Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/@ut_result_printer/printRuntimeString.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % PRINTRUNTIMESTRING returns a string listing the run time of the tests. | |
2 % | |
3 % VERSION: $Id: printRuntimeString.m,v 1.2 2010/10/26 12:18:33 hewitson Exp $ | |
4 % | |
5 function res = printRuntimeString(varargin) | |
6 | |
7 urp = varargin{1}; | |
8 if nargin>1 | |
9 limit = varargin{2}; | |
10 else | |
11 limit = inf; | |
12 end | |
13 | |
14 % build array of runtimes | |
15 runtimes = zeros(1,numel(urp.results)); | |
16 for kk=1:numel(urp.results) | |
17 r = urp.results(kk); | |
18 runtimes(kk) = r.runtime; | |
19 end | |
20 | |
21 % sort array | |
22 [y,idx] = sort(runtimes,'descend'); | |
23 results = urp.results(idx); | |
24 | |
25 res = sprintf('-------- Runtime ----------\n\n'); | |
26 for kk=1:numel(results) | |
27 r = results(kk); | |
28 res = [res sprintf('%0.3f s - %s/%s\n', r.runtime, r.testClass, r.testMethod)]; | |
29 if kk>limit | |
30 break | |
31 end | |
32 end | |
33 res = [res sprintf('\n\n----------------------------\n')]; | |
34 end |