CodeTools[Profiling] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

CodeTools[Profiling]

  

SortBy

  

analyze and display profiling data

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

SortBy(proc1, proc2, ..., tab1, tab2, ..., opts)

Parameters

proc1, proc2, ...

-

(optional) procedure

tab1, tab2, ...

-

(optional) table

opts

-

(optional) equation(s) of the form option=value where option is one of 'number', 'order', or 'statements'; specify options for the SortBy command

Description

• 

The SortBy() command analyzes the profiling data for all the procedures for which data is available and prints the results.

• 

The SortBy(proc1, proc2, ...) command analyzes the profiling data for the specified procedures and prints the results.

• 

The SortBy(proc1, proc2, ..., tab1, tab2, ...) command analyzes the profiling data for the specified procedures and tables and prints the results.

• 

The opts parameter can contain any of the following equations that specify options for the SortBy command.

  

 

  

'number' = nonnegative integer

  

Specifies the number of items displayed.  The number option can be used to control the maximum number of items displayed.  If number=n, the top n elements are selected after the items have been sorted.

  

 

  

'order' = value

  

Specifies how to sort the table.  If order is not specified, then the default is rload.

  

The optional argument order can be any one of the following:

  

 

alpha   -  sort table alphabetically by function name

ralpha  -  sort table reverse alphabetically by function name

time    -  sort table by increasing cpu time usage

rtime   -  sort table by decreasing cpu time usage

words   -  sort table by increasing memory usage

rwords  -  sort table by decreasing memory usage

calls   -  sort table by increasing number of calls to each function

rcalls  -  sort table by decreasing number of calls to each function

load    -  sort table by increasing memory^2*time

rload   -  sort table by decreasing memory^2*time

  

 

  

'statements' = true or false

  

Specifies whether to analyze procedures or statements.  If statements=true is specified, then the SortBy function analyzes the statements instead of procedures.   All the statements of the procedures are considered.

  

 

• 

When displaying statements, the procedure name, statement number, and an abbreviation of the statement are provided with the profiling information.

• 

It is possible that the total number of words used or the total time taken is zero.  In this case, the percent times and percent words are always zero, and the total percent time and the total percent words is 100%. If either of these events occur, SortBy prints a warning message.

Examples

a := proc( )
    local i;
    for i to 25 do
    int( sin(exp(x^i)), x );
    end do;
end proc:

b := proc( )
    local i;
    for i to 30 do
    int( tan(exp(x^i)), x );
    end do;
end proc:

c := proc( )
    a();
    b();
end proc:

withCodeToolsProfiling:

tBuildprocs=a,b,c,commands='c':

SortByt

function                 calls      time     time%          words    words%
---------------------------------------------------------------------------
c                            1     0.000      0.00             12      0.00
a                            1     0.675     38.77        7498833     47.02
b                            1     1.066     61.23        8448506     52.98
---------------------------------------------------------------------------
total:                       3     1.741    100.00       15947351    100.00

SortByt,order=time

function                 calls      time     time%          words    words%
---------------------------------------------------------------------------
b                            1     1.066     61.23        8448506     52.98
a                            1     0.675     38.77        7498833     47.02
c                            1     0.000      0.00             12      0.00
---------------------------------------------------------------------------
total:                       3     1.741    100.00       15947351    100.00

SortByt,order=words

function                 calls      time     time%          words    words%
---------------------------------------------------------------------------
b                            1     1.066     61.23        8448506     52.98
a                            1     0.675     38.77        7498833     47.02
c                            1     0.000      0.00             12      0.00
---------------------------------------------------------------------------
total:                       3     1.741    100.00       15947351    100.00

SortByt,order=load,statement=true

function                 calls      time     time%          words    words%
---------------------------------------------------------------------------
b                           30     1.066     61.23        8448506     52.98
 stat 2) 2       int(tan(exp(x^i)),x)

a                           25     0.675     38.77        7498833     47.02
 stat 2) 2       int(sin(exp(x^i)),x)

a                            1     0.000      0.00              0      0.00
 stat 1) 1   for i to 25 do

c                            1     0.000      0.00              6      0.00
 stat 1) 1   a();

b                            1     0.000      0.00              0      0.00
 stat 1) 1   for i to 30 do

c                            1     0.000      0.00              6      0.00
 stat 2) 2   b()

---------------------------------------------------------------------------
total:                      59     1.741    100.00       15947351    100.00

SortByt,order=load,number=3,statement=true

function                 calls      time     time%          words    words%
---------------------------------------------------------------------------
b                           30     1.066     61.23        8448506     52.98
 stat 2) 2       int(tan(exp(x^i)),x)

a                           25     0.675     38.77        7498833     47.02
 stat 2) 2       int(sin(exp(x^i)),x)

a                            1     0.000      0.00              0      0.00
 stat 1) 1   for i to 25 do

---------------------------------------------------------------------------
total:                      59     1.741    100.00       15947339    100.00

See Also

CodeTools[Profiling]

CodeTools[Profiling][Build]

CodeTools[Profiling][GetProfileTable]

CodeTools[Profiling][Merge]

CodeTools[Profiling][PrintProfiles]

CodeTools[Profiling][Profile]