Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
profile
Returns the profiling results of a function
Calling Sequence
c = profile(fun)
Arguments
- fun
a Scilab function
- c
a nx3 matrix containing the profiling results:
c(i,1)
: number of times the line i of the function has been executedc(i,2)
: cumulated CPU time [in seconds] spent to execute the line i of the functionc(i,3)
: Measurement of the interpreter effort to execute once the line i of the function [arbitrary unit]
Description
To use profile
on a function, the profiling of this function must have been first activated:
either by using the add_profiling command.
or if the function has beed defined with the deff command, by setting the optional argument of deff to "p".
Once the function executed, calling profile
returns a matrix, where each row contains the profiling results for the corresponding function line (including the header line of the function), such as the number of calls, and the total CPU time spent in that line, and a measurement of the interpretor effort to execute the line, as following:
Number of calls | Total CPU time (s) | Interpretor effort |
1 | 0 | 0 |
300 | 0.1 | 0 |
300 | 3.59 | 5 |
... | ... | ... |
Here we can see that the 3th line of the function has been called 300 times, for a total CPU time of 3.59 seconds.
Note: due to the precision limit of CPU time measure (typically one micro second), some executed lines which execution is very fast may appear with a CPU total time of 0.
Examples
// Function to be profiled function x=foo(n) if n > 0 then x = 0; for k = 1:n s = svd(rand(n, n)); x = x + s(1); end else x = []; end endfunction // Enables the profiling of the function add_profiling("foo"); // Executes the function foo(200); // Returns the function profiling results profile(foo)
See Also
- add_profiling — Enables the profiling of a function
- deff — определение функции во время выполнения программы
- plotprofile — Displays the profiling charts of a function
- showprofile — Outputs the function profiling results to the console
Report an issue | ||
<< plotprofile | profiling | remove_profiling >> |