Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.
See the recommended documentation of this function
Returns the profiling results of a function
c = profile(fun)
a Scilab function
a nx3 matrix containing the profiling results:
c(i,1): number of times the line i of the function has been executed
c(i,2): cumulated CPU time [in seconds] spent to execute the line i of the function
c(i,3): Measurement of the interpreter effort to execute once the line i of the function [arbitrary unit]
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|
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.
// 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)
- 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 >>|