The profile Function - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Procedures and Functions : Time and Space : profile

The profile Function

 

Calling Sequence

Parameters

Description

Examples

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:

profilefib

fib5

5

(1)

showprofilefib

function           depth    calls     time    time%         bytes   bytes%
---------------------------------------------------------------------------
fib                    5        9    0.000     0.00          6288   100.00
---------------------------------------------------------------------------
total:                 5        9    0.000     0.00          6288   100.00

unprofilefib

profilegcd&comma;divide&comma;expand&comma;randpoly

grandpolyx&comma;y&comma;degree&equals;2&comma;dense

g:=7x2&plus;22xy94y255x&plus;87y56

(2)

aexpandgrandpolyx&comma;y&comma;degree&equals;2&comma;dense&colon;

bexpandgrandpolyx&comma;y&comma;degree&equals;2&comma;dense&colon;

gcda&comma;b

7x222xy&plus;94y2&plus;55x87y&plus;56

(3)

showprofile

function           depth    calls     time    time%         bytes   bytes%
---------------------------------------------------------------------------
gcd                    1        1    0.010    43.48        548040    86.04
randpoly               1        3    0.013    56.52         82352    12.93
expand                 1        8    0.000     0.00          3488     0.55
divide                 1        6    0.000     0.00          3056     0.48
---------------------------------------------------------------------------
total:                 4       18    0.023   100.00        636936   100.00

resetprofile

profilegcd&comma;divide&comma;content

grandpolyx&comma;y&comma;degree&equals;3&comma;dense&colon;

aexpandgrandpolyx&comma;y&comma;degree&equals;7&comma;dense&colon;

bexpandgrandpolyx&comma;y&comma;degree&equals;7&comma;dense&colon;

gcda&comma;b

92x36x2y72xy287y374x237xy44y2&plus;23x29y98

(4)

showprofile

function           depth    calls     time    time%         bytes   bytes%
---------------------------------------------------------------------------
gcd                    1        1    0.004   100.00        242184    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.004   100.00        245112   100.00

See Also

CodeTools,Profile

exprofile

kernelopts

showprofile

unprofile

 


Download Help Document

Was this information helpful?



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