showstat - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Debugging : showstat

showstat

display a procedure with statement numbers for debugging

 Calling Sequence showstat(procName) showstat(procName, statRange)

Parameters

 procName - name of the procedure to display statRange - statement or range of statements to display

Description

 • The showstat function displays a procedure, with at most one statement per line, and with a statement number preceding each line. Statements are numbered consecutively, depth first, starting at 1. Statement numbers are used when using the debugger.
 • If a statement has a breakpoint associated with it, or if execution is currently stopped at the statement, the statement number is followed by one or two of the following characters:

 *       -there is a breakpoint at this statement. ?       -there is a conditional breakpoint at this statement. !       -execution is currently stopped here.

 • If showstat is called with no arguments, all procedures with breakpoints in them are displayed.
 • The statRange, if specified, can be either an integer, or a range of integers. In either case, only the specified statements are displayed. Elided statements are indicated by $...$ in the output.
 • If the procedure specified by procName has tracing information associated with it (see debugopts), showstat will show this information preceding each statement in the procedure. Three columns are displayed. The first column indicates the number of times that the statement has been executed. The second column indicates the amount of CPU time spent within the statement (including time spent within the body of a control structure, such as an if statement). The third column shows the amount of memory, in machine words, allocated by all executions of the statement (including memory allocated by statements within the body of a control structure). See the examples section for a sample of tracing information output.
 • Procedures that are exported from a module can be displayed by calling showstat(moduleName:-procedureName).
 • Procedures that are local to a module, and thus not normally accessible outside the module, can be displayed by calling showstat(moduleName::procedureName).
 • Calling showstat with a module name instead of a procedure name will display the module's ModuleApply procedure (if it has one).

Examples

 > f := proc(x) if x <= 2 then print(x); print(x^2) end if; print(-x); x^3 end proc:
 > $\mathrm{showstat}\left(f\right)$
 f := proc(x)    1   if x <= 2 then    2     print(x);    3     print(x^2)        end if;    4   print(-x);    5   x^3 end proc
 > $\mathrm{showstat}\left(f,1\right)$
 f := proc(x)    1   if x <= 2 then          ...        end if;        ... end proc
 > $\mathrm{showstat}\left(f,3..4\right)$
 f := proc(x)        ...    3     print(x^2)        end if;    4   print(-x);        ... end proc
 > $\mathrm{debugopts}\left(\mathrm{traceproc}=f\right)$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}5\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}f\left(i\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}$
 ${1}$
 ${1}$
 ${-}{1}$
 ${2}$
 ${4}$
 ${-}{2}$
 ${-}{3}$
 ${-}{4}$
 ${-}{5}$
 ${125}$ (1)
 > $\mathrm{showstat}\left(f\right)$
 f := proc(x)      |Calls Seconds  Words| PROC |    5   0.003  12614|    1 |    5   0.000     15| if x <= 2 then    2 |    2   0.000   3054|   print(x);    3 |    2   0.000   2711|   print(x^2)                             end if;    4 |    5   0.003   6814| print(-x);    5 |    5   0.000     20| x^3 end proc

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam