annotate doc/interpreter/debug.txi @ 20170:af2b7695f1c4 draft default tip @

gallery.m: clean and vectorize part of qmult. * scripts/special-matrix/gallery.m: make qmult() follow Octave guidelines, vectorize last for loop in qmult().
author Antonio Pino Robles <data.script93@gmail.com>
date Thu, 28 May 2015 18:32:47 +0200
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19593
diff changeset
1 @c Copyright (C) 1996-2015 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
4 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
8 @c your option) any later version.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18385
diff changeset
9 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
13 @c for more details.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18385
diff changeset
14 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6778
diff changeset
17 @c <http://www.gnu.org/licenses/>.
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
18
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
19 @node Debugging
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
20 @chapter Debugging
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
21
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
22 Octave includes a built-in debugger to aid in the development of
9039
51dc9691f23f Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
23 scripts. This can be used to interrupt the execution of an Octave script
51dc9691f23f Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
24 at a certain point, or when certain conditions are met. Once execution
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
25 has stopped, and debug mode is entered, the symbol table at the point
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
26 where execution has stopped can be examined and modified to check for
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
27 errors.
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
28
8485
2beb59bf773a [docs] commandline => command-line
Brian Gough <bjg@gnu.org>
parents: 8347
diff changeset
29 The normal command-line editing and history functions are available in
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
30 debug mode.
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
31
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
32 @menu
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
33 * Entering Debug Mode::
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
34 * Leaving Debug Mode::
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
35 * Breakpoints::
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
36 * Debug Mode::
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
37 * Call Stack::
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
38 * Profiling::
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
39 * Profiler Example::
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
40 @end menu
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
41
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
42 @node Entering Debug Mode
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
43 @section Entering Debug Mode
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
44
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
45 There are two basic means of interrupting the execution of an Octave
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16844
diff changeset
46 script. These are breakpoints (@pxref{Breakpoints}), discussed in the next
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
47 section, and interruption based on some condition.
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
48
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
49 Octave supports three means to stop execution based on the values set in
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
50 the functions @code{debug_on_interrupt}, @code{debug_on_warning}, and
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
51 @code{debug_on_error}.
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
52
4185
8f6d418d31c3 [project @ 2002-11-15 23:22:03 by jwe]
jwe
parents: 4175
diff changeset
53 @DOCSTRING(debug_on_interrupt)
4175
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
54
b3cd3d12da7e [project @ 2002-11-13 02:45:39 by jwe]
jwe
parents:
diff changeset
55 @DOCSTRING(debug_on_warning)
4185
8f6d418d31c3 [project @ 2002-11-15 23:22:03 by jwe]
jwe
parents: 4175
diff changeset
56
8f6d418d31c3 [project @ 2002-11-15 23:22:03 by jwe]
jwe
parents: 4175
diff changeset
57 @DOCSTRING(debug_on_error)
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
58
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
59 @node Leaving Debug Mode
10791
3140cb7a05a1 Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents: 9209
diff changeset
60 @section Leaving Debug Mode
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
61
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
62 Use either @code{dbcont} or @code{return} to leave the debug mode and
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
63 continue the normal execution of the script.
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
64
8275
aaccb1362347 debug.txi: typo
Soren Hauberg <hauberg@gmail.com>
parents: 7984
diff changeset
65 @DOCSTRING(dbcont)
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
66
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
67 To quit debug mode and return directly to the prompt without executing
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
68 any additional code use @code{dbquit}.
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
69
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
70 @DOCSTRING(dbquit)
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
71
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
72 Finally, typing @code{exit} or @code{quit} at the debug prompt will
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
73 result in Octave terminating normally.
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
74
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
75 @node Breakpoints
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
76 @section Breakpoints
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
77
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
78 Breakpoints can be set in any m-file function by using the @code{dbstop}
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
79 function.
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
80
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
81 @DOCSTRING(dbstop)
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
82
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
83 @noindent
18190
d638db6d045c doc: Note that dbstop can be used with class methods as well (bug #40958).
Rik <rik@octave.org>
parents: 17757
diff changeset
84 Breakpoints in class methods are also supported (e.g.,
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
85 @code{dbstop ("@@class/method")}). However, breakpoints cannot be set in
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
86 built-in functions (e.g., @code{sin}, etc.) or dynamically loaded functions
18190
d638db6d045c doc: Note that dbstop can be used with class methods as well (bug #40958).
Rik <rik@octave.org>
parents: 17757
diff changeset
87 (i.e., oct-files).
d638db6d045c doc: Note that dbstop can be used with class methods as well (bug #40958).
Rik <rik@octave.org>
parents: 17757
diff changeset
88
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
89 To set a breakpoint immediately upon entering a function use line number 1, or
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
90 omit the line number entirely and just give the function name. When setting
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
91 the breakpoint Octave will ignore the leading comment block, and the breakpoint
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
92 will be set on the first executable statement in the function. For example:
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
93
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
94 @example
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
95 @group
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
96 dbstop ("asind", 1)
16771
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
97 @result{} 29
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
98 @end group
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
99 @end example
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
100
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
101 @noindent
16771
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
102 Note that the return value of @code{29} means that the breakpoint was
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
103 effectively set to line 29. The status of breakpoints in a function can
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
104 be queried with @code{dbstatus}.
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
105
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
106 @DOCSTRING(dbstatus)
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
107
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
108 @noindent
16771
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
109 Reusing the previous example, @code{dbstatus ("asind")} will return
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
110 29. The breakpoints listed can then be cleared with the @code{dbclear}
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
111 function.
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
112
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
113 @DOCSTRING(dbclear)
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
114
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
115 @noindent
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
116
16771
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
117 A breakpoint may also be set in a subfunction. For example, if a file contains
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
118 the functions
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
119
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
120 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9039
diff changeset
121 @group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
122 function y = func1 (x)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
123 y = func2 (x);
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
124 endfunction
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
125 function y = func2 (x)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
126 y = x + 1;
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
127 endfunction
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9039
diff changeset
128 @end group
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
129 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
130
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
131 @noindent
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
132 then a breakpoint can be set at the start of the subfunction directly with
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
133
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
134 @example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
135 @group
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
136 dbstop (["func1", filemarker(), "func2"])
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
137 @result{} 5
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
138 @end group
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
139 @end example
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
140
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
141 Note that @code{filemarker} returns the character that marks subfunctions from
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
142 the file containing them. Unless the default has been changed this character
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
143 is @samp{>}. Thus, a quicker and more normal way to set the breakpoint would
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
144 be
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
145
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
146 @example
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
147 dbstop func1>func2
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
148 @end example
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
149
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8817
diff changeset
150 Another simple way of setting a breakpoint in an Octave script is the
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
151 use of the @code{keyboard} function.
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
152
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
153 @DOCSTRING(keyboard)
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
154
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
155 @noindent
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
156 The @code{keyboard} function is placed in a script at the point where the user
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
157 desires that the execution be stopped. It automatically sets the running
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
158 script into the debug mode.
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
159
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
160 @node Debug Mode
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
161 @section Debug Mode
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
162
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
163 There are three additional support functions that allow the user to
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
164 find out where in the execution of a script Octave entered the debug
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
165 mode, and to print the code in the script surrounding the point where
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
166 Octave entered debug mode.
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
167
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
168 @DOCSTRING(dbwhere)
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
169
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 4185
diff changeset
170 @DOCSTRING(dbtype)
6647
415b8b0106d0 [project @ 2007-05-22 02:57:21 by jwe]
jwe
parents: 6646
diff changeset
171
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
172 @DOCSTRING(dblist)
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
173
8817
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8485
diff changeset
174 You may also use @code{isdebugmode} to determine whether the debugger is
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8485
diff changeset
175 currently active.
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8485
diff changeset
176
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8485
diff changeset
177 @DOCSTRING(isdebugmode)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8485
diff changeset
178
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8817
diff changeset
179 Debug mode also allows single line stepping through a function using
16771
d8a719ccd464 doc: Improve documentation for command debugger.
Rik <rik@octave.org>
parents: 14138
diff changeset
180 the command @code{dbstep}.
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
181
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
182 @DOCSTRING(dbstep)
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
183
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
184 When in debug mode the @key{RETURN} key will execute the last entered command.
16844
1b0650075a74 doc: Add note about function of <RETURN> key in debug mode.
Rik <rik@octave.org>
parents: 16842
diff changeset
185 This is useful, for example, after hitting a breakpoint and entering
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
186 @code{dbstep} once. After that, one can advance line by line through the code
16844
1b0650075a74 doc: Add note about function of <RETURN> key in debug mode.
Rik <rik@octave.org>
parents: 16842
diff changeset
187 with only a single key stroke.
1b0650075a74 doc: Add note about function of <RETURN> key in debug mode.
Rik <rik@octave.org>
parents: 16842
diff changeset
188
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
189 @node Call Stack
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
190 @section Call Stack
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
191
18385
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
192 The function being debugged may be the leaf node of a series of function calls.
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
193 After examining values in the current subroutine it may turn out that the
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
194 problem occurred in earlier pieces of code. Use @code{dbup} and @code{dbdown}
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
195 to move up and down through the series of function calls to locate where
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
196 variables first took on the wrong values. @code{dbstack} shows the entire
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
197 series of function calls and at what level debugging is currently taking place.
7e39cbefe299 doc: Improve the documentation for the debug chapter of the manual.
Rik <rik@octave.org>
parents: 18190
diff changeset
198
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
199 @DOCSTRING(dbstack)
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
200
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
201 @DOCSTRING(dbup)
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
202
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7018
diff changeset
203 @DOCSTRING(dbdown)
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
204
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
205 @node Profiling
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
206 @section Profiling
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
207 @cindex profiler
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
208 @cindex code profiling
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
209
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
210 Octave supports profiling of code execution on a per-function level. If
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
211 profiling is enabled, each call to a function (supporting built-ins,
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
212 operators, functions in oct- and mex-files, user-defined functions in
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
213 Octave code and anonymous functions) is recorded while running Octave
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
214 code. After that, this data can aid in analyzing the code behavior, and
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
215 is in particular helpful for finding ``hot spots'' in the code which use
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
216 up a lot of computation time and are the best targets to spend
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
217 optimization efforts on.
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
218
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
219 The main command for profiling is @code{profile}, which can be used to
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
220 start or stop the profiler and also to query collected data afterwards.
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
221 The data is returned in an Octave data structure which can then be
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
222 examined or further processed by other routines or tools.
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
223
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
224 @DOCSTRING(profile)
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
225
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
226 An easy way to get an overview over the collected data is
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
227 @code{profshow}. This function takes the profiler data returned by
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
228 @code{profile} as input and prints a flat profile, for instance:
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
229
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
230 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
231 @group
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
232 Function Attr Time (s) Calls
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
233 ----------------------------------------
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
234 >myfib R 2.195 13529
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
235 binary <= 0.061 13529
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
236 binary - 0.050 13528
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
237 binary + 0.026 6764
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
238 @end group
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
239 @end example
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
240
13931
9de488c6c59c doc: Spellcheck documentation before 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 13195
diff changeset
241 This shows that most of the run time was spent executing the function
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
242 @samp{myfib}, and some minor proportion evaluating the listed binary
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
243 operators. Furthermore, it is shown how often the function was called
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
244 and the profiler also records that it is recursive.
12976
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
245
2e20c26b1007 Document the profiler functions.
Daniel Kraft <d@domob.eu>
parents: 12632
diff changeset
246 @DOCSTRING(profshow)
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
247
13195
08650b6fbf67 document profexplore and include it in the list of files to distribute
John W. Eaton <jwe@octave.org>
parents: 12979
diff changeset
248 @DOCSTRING(profexplore)
08650b6fbf67 document profexplore and include it in the list of files to distribute
John W. Eaton <jwe@octave.org>
parents: 12979
diff changeset
249
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
250 @node Profiler Example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
251 @section Profiler Example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
252
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16844
diff changeset
253 Below, we will give a short example of a profiler session.
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 16844
diff changeset
254 @xref{Profiling}, for the documentation of the profiler functions in
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
255 detail. Consider the code:
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
256
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
257 @example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
258 global N A;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
259
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
260 N = 300;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
261 A = rand (N, N);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
262
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
263 function xt = timesteps (steps, x0, expM)
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
264 global N;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
265
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
266 if (steps == 0)
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
267 xt = NA (N, 0);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
268 else
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
269 xt = NA (N, steps);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
270 x1 = expM * x0;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
271 xt(:, 1) = x1;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
272 xt(:, 2 : end) = timesteps (steps - 1, x1, expM);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
273 endif
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
274 endfunction
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
275
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
276 function foo ()
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
277 global N A;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
278
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
279 initial = @@(x) sin (x);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
280 x0 = (initial (linspace (0, 2 * pi, N)))';
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
281
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
282 expA = expm (A);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
283 xt = timesteps (100, x0, expA);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
284 endfunction
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
285
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
286 function fib = bar (N)
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
287 if (N <= 2)
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
288 fib = 1;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
289 else
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
290 fib = bar (N - 1) + bar (N - 2);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
291 endif
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
292 endfunction
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
293 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
294
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
295 If we execute the two main functions, we get:
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
296
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
297 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
298 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
299 tic; foo; toc;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
300 @result{} Elapsed time is 2.37338 seconds.
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
301
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
302 tic; bar (20); toc;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
303 @result{} Elapsed time is 2.04952 seconds.
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
304 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
305 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
306
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
307 But this does not give much information about where this time is spent;
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
308 for instance, whether the single call to @code{expm} is more expensive
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
309 or the recursive time-stepping itself. To get a more detailed picture,
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
310 we can use the profiler.
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
311
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
312 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
313 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
314 profile on;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
315 foo;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
316 profile off;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
317
17757
dae2230227a7 doc: Use double-quote in preference to single quote in code examples.
Rik <rik@octave.org>
parents: 17744
diff changeset
318 data = profile ("info");
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
319 profshow (data, 10);
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
320 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
321 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
322
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
323 This prints a table like:
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
324
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
325 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
326 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
327 # Function Attr Time (s) Calls
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
328 ---------------------------------------------
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
329 7 expm 1.034 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
330 3 binary * 0.823 117
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
331 41 binary \ 0.188 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
332 38 binary ^ 0.126 2
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
333 43 timesteps R 0.111 101
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
334 44 NA 0.029 101
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
335 39 binary + 0.024 8
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
336 34 norm 0.011 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
337 40 binary - 0.004 101
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
338 33 balance 0.003 1
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
339 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
340 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
341
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
342 The entries are the individual functions which have been executed (only
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
343 the 10 most important ones), together with some information for each of
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
344 them. The entries like @samp{binary *} denote operators, while other
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
345 entries are ordinary functions. They include both built-ins like
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
346 @code{expm} and our own routines (for instance @code{timesteps}). From
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
347 this profile, we can immediately deduce that @code{expm} uses up the
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
348 largest proportion of the processing time, even though it is only called
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
349 once. The second expensive operation is the matrix-vector product in the
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
350 routine @code{timesteps}. @footnote{We only know it is the binary
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
351 multiplication operator, but fortunately this operator appears only at
13931
9de488c6c59c doc: Spellcheck documentation before 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 13195
diff changeset
352 one place in the code and thus we know which occurrence takes so much
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
353 time. If there were multiple places, we would have to use the
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
354 hierarchical profile to find out the exact place which uses up the time
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
355 which is not covered in this example.}
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
356
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
357 Timing, however, is not the only information available from the profile.
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
358 The attribute column shows us that @code{timesteps} calls itself
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
359 recursively. This may not be that remarkable in this example (since it's
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
360 clear anyway), but could be helpful in a more complex setting. As to the
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
361 question of why is there a @samp{binary \} in the output, we can easily
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
362 shed some light on that too. Note that @code{data} is a structure array
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
363 (@ref{Structure Arrays}) which contains the field @code{FunctionTable}.
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
364 This stores the raw data for the profile shown. The number in the first
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
365 column of the table gives the index under which the shown function can
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
366 be found there. Looking up @code{data.FunctionTable(41)} gives:
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
367
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
368 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
369 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
370 scalar structure containing the fields:
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
371
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
372 FunctionName = binary \
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
373 TotalTime = 0.18765
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
374 NumCalls = 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
375 IsRecursive = 0
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
376 Parents = 7
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
377 Children = [](1x0)
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
378 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
379 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
380
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
381 Here we see the information from the table again, but have additional
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
382 fields @code{Parents} and @code{Children}. Those are both arrays, which
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
383 contain the indices of functions which have directly called the function
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
384 in question (which is entry 7, @code{expm}, in this case) or been called
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
385 by it (no functions). Hence, the backslash operator has been used
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
386 internally by @code{expm}.
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
387
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
388 Now let's take a look at @code{bar}. For this, we start a fresh
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
389 profiling session (@code{profile on} does this; the old data is removed
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
390 before the profiler is restarted):
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
391
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
392 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
393 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
394 profile on;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
395 bar (20);
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
396 profile off;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
397
17757
dae2230227a7 doc: Use double-quote in preference to single quote in code examples.
Rik <rik@octave.org>
parents: 17744
diff changeset
398 profshow (profile ("info"));
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
399 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
400 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
401
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
402 This gives:
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
403
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
404 @example
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
405 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
406 # Function Attr Time (s) Calls
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
407 -------------------------------------------------------
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
408 1 bar R 2.091 13529
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
409 2 binary <= 0.062 13529
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
410 3 binary - 0.042 13528
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
411 4 binary + 0.023 6764
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
412 5 profile 0.000 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
413 8 false 0.000 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
414 6 nargin 0.000 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
415 7 binary != 0.000 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
416 9 __profiler_enable__ 0.000 1
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
417 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
418 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
419
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
420 Unsurprisingly, @code{bar} is also recursive. It has been called 13,529
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
421 times in the course of recursively calculating the Fibonacci number in a
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
422 suboptimal way, and most of the time was spent in @code{bar} itself.
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
423
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
424 Finally, let's say we want to profile the execution of both @code{foo}
14038
b0cdd60db5e5 doc: Grammarcheck documentation ahead of 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents: 13931
diff changeset
425 and @code{bar} together. Since we already have the run-time data
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
426 collected for @code{bar}, we can restart the profiler without clearing
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
427 the existing data and collect the missing statistics about @code{foo}.
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
428 This is done by:
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
429
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
430 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
431 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
432 profile resume;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
433 foo;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
434 profile off;
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
435
17757
dae2230227a7 doc: Use double-quote in preference to single quote in code examples.
Rik <rik@octave.org>
parents: 17744
diff changeset
436 profshow (profile ("info"), 10);
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
437 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
438 @end example
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
439
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
440 As you can see in the table below, now we have both profiles mixed
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
441 together.
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
442
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
443 @example
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
444 @group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
445 # Function Attr Time (s) Calls
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
446 ---------------------------------------------
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
447 1 bar R 2.091 13529
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
448 16 expm 1.122 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
449 12 binary * 0.798 117
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
450 46 binary \ 0.185 1
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
451 45 binary ^ 0.124 2
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
452 48 timesteps R 0.115 101
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
453 2 binary <= 0.062 13529
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
454 3 binary - 0.045 13629
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
455 4 binary + 0.041 6772
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
456 49 NA 0.036 101
12979
6a9fbeff3368 Proofread profiler documentation
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12978
diff changeset
457 @end group
12978
fb0f40cd8752 Add an example profiler session to the manual.
Daniel Kraft <d@domob.eu>
parents: 12976
diff changeset
458 @end example