annotate scripts/time/toc.m @ 6985:cf2f6090147a

[project @ 2007-10-09 16:37:45 by jwe]
author jwe
date Tue, 09 Oct 2007 16:37:45 +0000
parents 34cda7d94c08
children 93c65f2a5668
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1996, 1997 John W. Eaton
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
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
8 ## any later version.
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
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
18 ## 02110-1301, USA.
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
19
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefn {Function File} {} toc ()
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
22 ## See tic.
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
23 ## @end deftypefn
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
24
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
25 ## Author: jwe
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
26
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
27 function secs = toc ()
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
28
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
29 if (nargin != 0)
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
30 warning ("toc: ignoring extra arguments");
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
31 endif
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
32
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
33 global __tic_toc_timestamp__ = -1;
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
34
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
35 if (__tic_toc_timestamp__ < 0)
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
36 warning ("toc called before timer set");
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
37 secs0 = [];
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
38 else
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
39 secs0 = etime (clock (), __tic_toc_timestamp__);
5717
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
40 if (nargout != 0)
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
41 secs = secs0;
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
42 else
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
43 printf ("Elapsed time is %f seconds.\n", secs0);
34cda7d94c08 [project @ 2006-03-27 22:26:18 by jwe]
jwe
parents: 5633
diff changeset
44 endif
5633
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
45 endif
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
46
92f8b2723c8c [project @ 2006-02-28 02:11:27 by jwe]
jwe
parents:
diff changeset
47 endfunction