O-Matrix Profiling Description
If profiling is turned on, each time that a function returns, the amount of time that was spent in the function is added to the profiling time for that function. This includes the time spent by other
functions that were called by the function. O-Matrix function calls and returns will be slightly slower when profiling is turned on.
No Option
If option is not present, the return value of the profile function is the current profiling information as a character matrix. Each row of the return value corresponds to a function and contains three
fields separated by commas. The first field is the total time corresponding to the function in seconds. The second field is the name of the function. If the function is local to a file, the third field
is the name of the file. If the function is not local to a file, the third field is blank. The align function can be used to line up the fields in the return value. The sort function can be used to sort
this information.
On Option
If option is the character row vector "on", profiling is turned on and the total time for each function is initialized as zero.
Off Option
If option is the character row vector "off", profiling is turned off. This will free the memory that is used for profiling and it will make function calls and returns slightly faster.
Example
If you enter
clear function fac1(n) begin if n == 1 then return 1d0 return n * fac1(n - 1) end
function fac2(n) begin fac = 1d0 for i = 1 to n begin
fac = fac * i end return fac end
profile("on") fac1(200); fac2(200); print profile O-Matrix will respond
0.140,fac1, 0.010,fac2,\
(Note that the times on your system will probably be different.) This shows that the fac2 function computes factorials faster than the fac1 function.
Reference
The clear and load commands turn profiling off.
If you call the profile function with no arguments when profiling is turned off, an error message will result.
You cannot call the profile function from within another function.
Back to O-Matrix Programming Page.
|