annotate scripts/time/toc.m @ 7017:a1dbe9d80eee

[project @ 2007-10-12 21:27:11 by jwe]
author jwe
date Fri, 12 Oct 2007 21:27:37 +0000
parents 93c65f2a5668
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
2 ##
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
4 ##
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5717
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5717
diff changeset
8 ## your option) any later version.
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
9 ##
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
14 ##
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5717
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5717
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
18
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {} toc ()
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
21 ## See tic.
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
22 ## @end deftypefn
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
23
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
24 ## Author: jwe
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
25
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
26 function secs = toc ()
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
27
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
28 if (nargin != 0)
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
29 warning ("toc: ignoring extra arguments");
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
30 endif
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
31
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
32 global __tic_toc_timestamp__ = -1;
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
33
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
34 if (__tic_toc_timestamp__ < 0)
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
35 warning ("toc called before timer set");
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
36 secs0 = [];
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
37 else
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
38 secs0 = etime (clock (), __tic_toc_timestamp__);
5717
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
39 if (nargout != 0)
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
40 secs = secs0;
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
41 else
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
42 printf ("Elapsed time is %f seconds.\n", secs0);
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
43 endif
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
44 endif
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
45
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
46 endfunction