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:
profile⁡fib
fib⁡5
5
showprofile⁡fib
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
unprofile⁡fib
profile⁡gcd,divide,expand,randpoly
g ≔ randpoly⁡x,y,degree=2,dense
g≔−7⁢x2+22⁢x⁢y−94⁢y2−55⁢x+87⁢y−56
a ≔ expand⁡g⁢randpoly⁡x,y,degree=2,dense:
b ≔ expand⁡g⁢randpoly⁡x,y,degree=2,dense:
gcd⁡a,b
7⁢x2−22⁢x⁢y+94⁢y2+55⁢x−87⁢y+56
showprofile⁡
function depth calls time time% bytes bytes% --------------------------------------------------------------------------- gcd 1 1 0.009 90.00 532856 86.12 randpoly 1 3 0.001 10.00 79344 12.82 expand 1 8 0.000 0.00 3488 0.56 divide 1 6 0.000 0.00 3056 0.49 --------------------------------------------------------------------------- total: 4 18 0.010 100.00 618744 100.00
resetprofile⁡
profile⁡gcd,divide,content
g ≔ randpoly⁡x,y,degree=3,dense:
a ≔ expand⁡g⁢randpoly⁡x,y,degree=7,dense:
b ≔ expand⁡g⁢randpoly⁡x,y,degree=7,dense:
92⁢x3−6⁢x2⁢y−72⁢x⁢y2−87⁢y3−74⁢x2−37⁢x⁢y−44⁢y2+23⁢x−29⁢y−98
function depth calls time time% bytes bytes% --------------------------------------------------------------------------- gcd 1 1 0.003 100.00 242632 98.81 divide 1 6 0.000 0.00 2928 1.19 content 0 0 0.000 0.00 0 0.00 --------------------------------------------------------------------------- total: 2 7 0.003 100.00 245560 100.00
See Also
CodeTools,Profile
exprofile
kernelopts
showprofile
unprofile
Download Help Document