Mercurial > octave
annotate scripts/profiler/profexplore.m @ 30875:5d3faba0342e
doc: Ensure documentation lists output argument when it exists for all m-files.
For new users of Octave it is best to show explicit calling forms
in the documentation and to show a return argument when it exists.
* bp-table.cc, shift.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m,
bitget.m, bitset.m, blkdiag.m, celldisp.m, cplxpair.m, dblquad.m, flip.m,
fliplr.m, flipud.m, idivide.m, int2str.m, interpft.m, logspace.m, num2str.m,
polyarea.m, postpad.m, prepad.m, randi.m, repmat.m, rng.m, rot90.m, rotdim.m,
structfun.m, triplequad.m, uibuttongroup.m, uicontrol.m, uipanel.m,
uipushtool.m, uitoggletool.m, uitoolbar.m, waitforbuttonpress.m, help.m,
__additional_help_message__.m, hsv.m, im2double.m, im2frame.m, javachk.m,
usejava.m, argnames.m, char.m, formula.m, inline.m, __vectorize__.m, findstr.m,
flipdim.m, strmatch.m, vectorize.m, commutation_matrix.m, cond.m, cross.m,
duplication_matrix.m, expm.m, orth.m, rank.m, rref.m, trace.m, vech.m, cast.m,
compare_versions.m, delete.m, dir.m, fileattrib.m, grabcode.m, gunzip.m,
inputname.m, license.m, list_primes.m, ls.m, mexext.m, movefile.m,
namelengthmax.m, nargoutchk.m, nthargout.m, substruct.m, swapbytes.m, ver.m,
verLessThan.m, what.m, fminunc.m, fsolve.m, fzero.m, optimget.m, __fdjac__.m,
matlabroot.m, savepath.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m,
camzoom.m, clabel.m, diffuse.m, legend.m, orient.m, rticks.m, specular.m,
thetaticks.m, xlim.m, xtickangle.m, xticklabels.m, xticks.m, ylim.m,
ytickangle.m, yticklabels.m, yticks.m, zlim.m, ztickangle.m, zticklabels.m,
zticks.m, ellipsoid.m, isocolors.m, isonormals.m, stairs.m, surfnorm.m,
__actual_axis_position__.m, __pltopt__.m, close.m, graphics_toolkit.m, pan.m,
print.m, printd.m, __ghostscript__.m, __gnuplot_print__.m, __opengl_print__.m,
rotate3d.m, subplot.m, zoom.m, compan.m, conv.m, poly.m, polyaffine.m,
polyder.m, polyint.m, polyout.m, polyreduce.m, polyvalm.m, roots.m, prefdir.m,
prefsfile.m, profexplore.m, profexport.m, profshow.m, powerset.m, unique.m,
arch_rnd.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m,
durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, fractdiff.m, hamming.m,
hanning.m, hurst.m, ifftshift.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m,
sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m,
ilu.m, __sprand__.m, sprand.m, sprandn.m, sprandsym.m, treelayout.m, beta.m,
betainc.m, betaincinv.m, betaln.m, cosint.m, expint.m, factorial.m, gammainc.m,
gammaincinv.m, lcm.m, nthroot.m, perms.m, reallog.m, realpow.m, realsqrt.m,
sinint.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m,
toeplitz.m, vander.m, wilkinson.m, center.m, corr.m, cov.m, discrete_cdf.m,
discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m,
empirical_inv.m, empirical_pdf.m, empirical_rnd.m, kendall.m, kurtosis.m,
mad.m, mean.m, meansq.m, median.m, mode.m, moment.m, range.m, ranks.m,
run_count.m, skewness.m, spearman.m, statistics.m, std.m, base2dec.m,
bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m,
hex2dec.m, index.m, regexptranslate.m, rindex.m, strcat.m, strjust.m,
strtrim.m, strtrunc.m, substr.m, untabify.m, __have_feature__.m,
__prog_output_assert__.m, __run_test_suite__.m, example.m, fail.m, asctime.m,
calendar.m, ctime.m, date.m, etime.m:
Add return arguments to @deftypefn macros where they were missing. Rename
variables in functions (particularly generic "retval") to match documentation.
Rename some return variables for (hopefully) better clarity (e.g., 'ax' to 'hax'
to indicate it is a graphics handle to an axes object).
author | Rik <rik@octave.org> |
---|---|
date | Wed, 30 Mar 2022 20:40:27 -0700 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 ## Copyright (C) 2012-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
7 ## |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
14 ## |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
19 ## |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
25 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20231
diff
changeset
|
27 ## @deftypefn {} {} profexplore () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20231
diff
changeset
|
28 ## @deftypefnx {} {} profexplore (@var{data}) |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
29 ## Interactively explore hierarchical profiler output. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
30 ## |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
31 ## Assuming @var{data} is the structure with profile data returned by |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17202
diff
changeset
|
32 ## @code{profile (@qcode{"info"})}, this command opens an interactive prompt |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
33 ## that can be used to explore the call-tree. Type @kbd{help} to get a list |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17202
diff
changeset
|
34 ## of possible commands. If @var{data} is omitted, @code{profile ("info")} |
17202
9e613baf431e
profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents:
14359
diff
changeset
|
35 ## is called and used in its place. |
13191
c5ddb99ff5de
Put @seealso in profiler functions' docstrings.
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13189
diff
changeset
|
36 ## @seealso{profile, profshow} |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
37 ## @end deftypefn |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
38 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
39 function profexplore (data) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
40 |
17202
9e613baf431e
profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents:
14359
diff
changeset
|
41 if (nargin == 0) |
9e613baf431e
profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents:
14359
diff
changeset
|
42 data = profile ("info"); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
43 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
44 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
45 ## The actual work is done by a recursive worker function, since that |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
46 ## is an easy way to traverse the tree datastructure. Here, we just check |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
47 ## the arguments (already done) and give over to it. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
48 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
49 __profexplore_worker (data.FunctionTable, data.Hierarchical, "Top\n", " "); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
50 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
51 endfunction |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
52 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
53 ## This is the worker function. tree is the current subtree we want to |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14222
diff
changeset
|
54 ## display / explore. parents is a string containing the already "rendered" |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
55 ## data for the parents which is displayed on top of the list of current |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
56 ## children. prefix is the prefix to add to each line rendered; this |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
57 ## is just a string of spaces to get indentation right. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
58 ## |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
59 ## Returning 0 indicates that the user requested to totally exit the |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
60 ## explorer, thus also all higher levels should exit immediately. An integer |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
61 ## greater zero indicates to exit that many levels since the user wants to go |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
62 ## up (but not necessarily quit). |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
63 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
64 function rv = __profexplore_worker (fcn_table, tree, parents, prefix) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
65 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
66 ## Sort children by total time. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
67 times = -[ tree.TotalTime ]; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
68 [~, p] = sort (times); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
69 tree = tree(p); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
70 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
71 while (true) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
72 |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
73 printf ("\n%s", parents); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
74 strings = cell (length (tree), 1); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
75 for i = 1 : length (tree) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
76 strings{i} = sprintf ("%s: %d calls, %.3f total, %.3f self", ... |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
77 fcn_table(tree(i).Index).FunctionName, ... |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
78 tree(i).NumCalls, ... |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
79 tree(i).TotalTime, tree(i).SelfTime); |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
80 printf ("%s%d) %s\n", prefix, i, strings{i}); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
81 endfor |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
82 printf ("\n"); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
83 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
84 cmd = input ("profexplore> ", "s"); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
85 option = fix (str2double (cmd)); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
86 |
17202
9e613baf431e
profexplore.m: Allow calling with no args, add "quit" as alias to "exit".
Philipp Kutin <philipp.kutin@gmail.com>
parents:
14359
diff
changeset
|
87 if (strcmp (cmd, "exit") || strcmp (cmd, "quit")) |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
88 rv = 0; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
89 return; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
90 elseif (strcmp (cmd, "help")) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
91 printf ("\nCommands for profile explorer:\n\n"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
92 printf ("exit Return to Octave prompt.\n"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
93 printf ("quit Return to Octave prompt.\n"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
94 printf ("help Display this help message.\n"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
95 printf ("up [N] Go up N levels, where N is an integer. Default is 1.\n"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
96 printf ("N Go down a level into option N.\n"); |
14222
190952239c2c
Use '!' for not operation in preference to '~'.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
97 elseif (! isnan (option)) |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
98 if (option < 1 || option > length (tree)) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
99 printf ("The chosen option is out of range!\n"); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
100 else |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
101 newParents = sprintf ("%s%s%s\n", parents, prefix, strings{option}); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
102 newPrefix = sprintf ("%s ", prefix); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
103 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
104 rv = __profexplore_worker (fcn_table, tree(option).Children, ... |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
105 newParents, newPrefix); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
106 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
107 if (rv == 0) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
108 return; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
109 elseif (rv > 1) |
20231
83792dd9bcc1
Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
110 rv -= 1; |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
111 return; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
112 else |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
113 assert (rv == 1); |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
114 ## It was requested to return to this level, so just stay. |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
115 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
116 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
117 elseif (length (cmd) >= 2 && strcmp (substr (cmd, 1, 2), "up")) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
118 if (length (cmd) == 2) |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
119 rv = 1; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
120 return; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
121 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
122 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
123 if (length (cmd) > 3 && cmd(3) == ' ') |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
124 opt = fix (str2double (substr (cmd, 3))); |
14222
190952239c2c
Use '!' for not operation in preference to '~'.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
125 if (! isnan (opt) && opt > 0) |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
126 rv = opt; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
127 return; |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
128 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
129 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
130 |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
131 printf ("Invalid 'up' command. Type 'help' for further"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
132 printf (" information.\n"); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
133 else |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
134 printf ("Unrecognized input. Type 'help' to get a list of possible"); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
135 printf (" commands.\n"); |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
136 endif |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
137 |
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
138 endwhile |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
139 |
13189
c5a8b23db680
New function 'profexplore' for interactive hierarchical profile exploration.
Daniel Kraft <d@domob.eu>
parents:
diff
changeset
|
140 endfunction |