CodeTools[Profiling]
Remove
remove procedures from a table of profiling data
Calling Sequence
Parameters
Description
Examples
Remove(selector, tab)
selector
-
boolean valued procedure
tab
table of profiling data
The Remove(selector, tab) command is similar to the remove function. The boolean valued function selector is called on each element in tab. A copy of tab is returned with the elements for which selector returns true removed.
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 argument is the rtable containing the profiling data.
with⁡CodeToolsProfiling:
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,tif5<t[1][1]thenreturntrueelsereturnfalseend ifend proc
a := proc( ) return 1; end proc;
a ≔ procreturn1end proc
b := proc( ) local i; for i from 1 to 10 do a(); end do; end proc;
b ≔ proclocali;forito10doa⁡end doend proc
t≔Build⁡procs=a,b,commands=b⁡
t≔table⁡_Inert_ASSIGNEDNAME⁡b,PROC=1001001000,_Inert_ASSIGNEDNAME⁡a,PROC=10001000
PrintProfiles⁡t
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≔Remove⁡selector,t
s≔table⁡_Inert_ASSIGNEDNAME⁡b,PROC=1001001000
PrintProfiles⁡s
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
See Also
CodeTools[EncodeName]
CodeTools[Profiling][Build]
CodeTools[Profiling][GetProfileTable]
CodeTools[Profiling][Merge]
CodeTools[Profiling][PrintProfiles]
CodeTools[Profiling][Select]
rtable
Download Help Document