The profile Function
Calling Sequence
Parameters
Description
Examples
profile(procedure1, procedure2, ...)
procedure1, procedure2, ...
-
any number of valid Maple procedures that have not already been profiled with profile
The procedure profile alters the given procedures to record runtime information on the procedures. If profile is successful, it returns NULL on exit.
The profiling information is printed using the showprofile() function as shown in the examples below. For more options and examples see showprofile. To stop collecting profiling information on a function, use unprofile(). To reset the profiler to begin a new profile use resetprofile().
Use of profile() increases memory usage and slows down computations, sometimes dramatically. In addition, profile may not work properly with procedures that have special evaluation rules.
A closely related function, exprofile(), can be used to profile all Maple functions at once.
fib:=proc(n) option remember; if n<2 then n else fib(n-1)+fib(n-2) end if; end proc:
profilefib
fib5
5
showprofilefib
function depth calls time time% bytes bytes% --------------------------------------------------------------------------- fib 5 9 0.001 100.00 6512 100.00 --------------------------------------------------------------------------- total: 5 9 0.001 100.00 6512 100.00
unprofilefib
profilegcd,divide,expand,randpoly
g≔randpolyx,y,degree=2,dense
g≔−7x2+22xy−94y2−55x+87y−56
a≔expandgrandpolyx,y,degree=2,dense:
b≔expandgrandpolyx,y,degree=2,dense:
gcda,b
7x2−22xy+94y2+55x−87y+56
showprofile
function depth calls time time% bytes bytes% --------------------------------------------------------------------------- gcd 1 1 0.006 66.67 615144 86.36 randpoly 1 3 0.002 22.22 90592 12.72 divide 1 6 0.001 11.11 3056 0.43 expand 1 8 0.000 0.00 3488 0.49 --------------------------------------------------------------------------- total: 4 18 0.009 100.00 712280 100.00
resetprofile
profilegcd,divide,content
g≔randpolyx,y,degree=3,dense:
a≔expandgrandpolyx,y,degree=7,dense:
b≔expandgrandpolyx,y,degree=7,dense:
92x3−6x2y−72xy2−87y3−74x2−37xy−44y2+23x−29y−98
function depth calls time time% bytes bytes% --------------------------------------------------------------------------- gcd 1 1 0.003 100.00 251752 98.85 divide 1 6 0.000 0.00 2928 1.15 content 0 0 0.000 0.00 0 0.00 --------------------------------------------------------------------------- total: 2 7 0.003 100.00 254680 100.00
See Also
CodeTools,Profile
exprofile
kernelopts
showprofile
unprofile
Download Help Document