The profile Function
|
Calling Sequence
|
|
profile(procedure1, procedure2, ...)
|
|
Parameters
|
|
procedure1, procedure2, ...
|
-
|
any number of valid Maple procedures that have not already been profiled with profile
|
|
|
|
|
Description
|
|
•
|
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.
|
|
|
Examples
|
|
>
|
fib:=proc(n) option remember; if n<2 then n else fib(n-1)+fib(n-2) end if; end proc:
|
>
|
|
>
|
|
| (1) |
>
|
|
function depth calls time time% bytes bytes%
---------------------------------------------------------------------------
fib 5 9 0.000 0.00 6168 100.00
---------------------------------------------------------------------------
total: 5 9 0.000 0.00 6168 100.00
| |
>
|
|
>
|
|
>
|
|
| (2) |
>
|
|
>
|
|
>
|
|
| (3) |
>
|
|
function depth calls time time% bytes bytes%
---------------------------------------------------------------------------
gcd 1 1 0.011 91.67 552280 84.89
randpoly 1 3 0.001 8.33 74504 11.45
expand 1 8 0.000 0.00 6160 0.95
divide 1 6 0.000 0.00 17656 2.71
---------------------------------------------------------------------------
total: 4 18 0.012 100.00 650600 100.00
| |
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (4) |
>
|
|
function depth calls time time% bytes bytes%
---------------------------------------------------------------------------
gcd 1 1 0.005 71.43 253256 69.59
divide 1 6 0.002 28.57 110656 30.41
content 0 0 0.000 0.00 0 0.00
---------------------------------------------------------------------------
total: 2 7 0.007 100.00 363912 100.00
| |
|
|
Download Help Document
Was this information helpful?