select procedures from a table of profiling data - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Profiling : CodeTools[Profiling] : CodeTools/Profiling/Select

CodeTools[Profiling][Select] - select procedures from a table of profiling data

Calling Sequence

Select(selector, tab)

Parameters

selector

-

boolean valued procedure

tab

-

table of profiling data

Description

• 

The Select(selector, tab) command is similar to the select function.  The boolean valued procedure, selector, is called on each element in tab.  A new table is returned containing only those elements of tab for which selector returns true.

• 

The selector parameter is a procedure that accepts two arguments. The first argument is the encoded name (see EncodeName) of the procedure and the second is the rtable containing the profiling data.

Examples

withCodeTools[Profiling]:

selector := proc(n,t)
    # check the total number of function calls
    if (t[1][1] > 5) then
        return true;
    else
    return false;
    end if;
end proc;

selector:=procn&comma;tif5<t&lsqb;1&rsqb;&lsqb;1&rsqb;thenreturntrueelsereturnfalseend ifend proc

(1)

a := proc( )
    return 1;
end proc;

a:=procreturn1end proc

(2)

b := proc( )
    local i;
    for i from 1 to 10 do
        a();
    end do;
end proc;

b:=proclocali&semi;forito10doaend doend proc

(3)

t:=Buildprocs&equals;a&comma;b&comma;commands&equals;&apos;b&apos;

t:=table_Inert_ASSIGNEDNAMEa&comma;PROC&equals;10001000&comma;_Inert_ASSIGNEDNAMEb&comma;PROC&equals;1001001000

(4)

PrintProfilest

a
a := proc()
     |Calls Seconds  Words|
PROC |   10   0.000      0|
   1 |   10   0.000      0| return 1
end proc

b
b := proc()
local i;
     |Calls Seconds  Words|
PROC |    1   0.000      0|
   1 |    1   0.000      0| for i to 10 do
   2 |   10   0.000      0|   a()
                            end do
end proc

s:=Selectselector&comma;t

s:=table_Inert_ASSIGNEDNAMEa&comma;PROC&equals;10001000

(5)

PrintProfiless

a
a := proc()
     |Calls Seconds  Words|
PROC |   10   0.000      0|
   1 |   10   0.000      0| return 1
end proc

See Also

CodeTools[EncodeName], CodeTools[Profiling], CodeTools[Profiling][Build], CodeTools[Profiling][GetProfileTable], CodeTools[Profiling][Merge], CodeTools[Profiling][PrintProfiles], CodeTools[Profiling][Remove], rtable, select


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