CodeTools[Profiling] - Maple Programming Help

Home : Support : Online Help : Programming : Profiling : CodeTools Profiling Subpackage : CodeTools/Profiling/GetProfileTable

CodeTools[Profiling]

 GetProfileTable
 get the raw profiling data associated with a procedure

 Calling Sequence GetProfileTable(p, opts)

Parameters

 p - procedure whose profiling data is to be returned opts - equation(s) of the form output=value where value is one of default or table; specify the type of output

Description

 • The GetProfileTable(p) command returns the rtable of profiling data associated with the procedure p.
 • You may not need to access the profiling data at this level.  It is usually more useful to use the table of data returned by a call to Build.
 • The format of the profiling data is as follows:
 If p has n statements, the data is an rtable of n+1 rows and 3 columns.  The first column is the count of the number of calls, the second is the time spent executing the statement (in milliseconds), and the third is the number of words allocated while executing the statement.  The first row of the rtable is the total calls, time spent, and words used for the entire function.  The rtable has datatype integer[4] and has order C_order.
 • If you specify the output = table option, GetProfileTable returns the rtable within a table.  This table is compatible with the tables used by other Profiling functions, for example, Merge and PrintProfiles.
 • It is possible for a procedure name to be assigned a new procedure after the rtable of profiling data has been obtained.  If this occurs, the rtable is no longer valid profiling data for that name.  However, if other names exist that reference the procedure, then the rtable may still be useful.

Examples

 > a := proc(x)     if (x > 1) then         return 1;     else         return 0;     end if; end proc:
 > $\mathrm{with}\left(\mathrm{CodeTools}\left[\mathrm{Profiling}\right]\right):$
 > $\mathrm{Profile}\left(a\right)$
 > $a\left(0\right)$
 ${0}$ (1)
 > $\mathrm{GetProfileTable}\left(a\right)$
 $\left[\begin{array}{ccc}{1}& {0}& {3}\\ {1}& {0}& {3}\\ {0}& {0}& {0}\\ {1}& {0}& {0}\end{array}\right]$ (2)
 > $\mathrm{GetProfileTable}\left(a,'\mathrm{output}'='\mathrm{table}'\right)$
 ${table}{}\left(\left[{\mathrm{_Inert_ASSIGNEDNAME}}{}\left({"a"}{,}{"PROC"}\right){=}\left[\begin{array}{ccc}{1}& {0}& {3}\\ {1}& {0}& {3}\\ {0}& {0}& {0}\\ {1}& {0}& {0}\end{array}\right]\right]\right)$ (3)
 > $a\left(2\right)$
 ${1}$ (4)
 > $\mathrm{GetProfileTable}\left(a\right)$
 $\left[\begin{array}{ccc}{2}& {0}& {6}\\ {2}& {0}& {6}\\ {1}& {0}& {0}\\ {1}& {0}& {0}\end{array}\right]$ (5)