<< reset_profiling profiling bloc2exp >>
removed >> removed > 5-5-2 > profiling > showprofile

showprofile

Outputs the function profiling results to the console

Calling Sequence

showprofile(fun)

Arguments

fun

a Scilab function

Description

To use showprofile on a function, the profiling of this function must have been first activated:

Once the function has been executed, calling showprofile outputs to the console the profiling results.

For each function line (including the header of function), are printed the following informations, in order:

An example of output:

            |1  |0   |0| 1: function x=fun(n)
            |1  |0   |0| 2:   if n > 0 then
            |1  |0   |2| 3:     x = 0;
            |200|0.01|0| 4:     for k = 1:n
            |200|3.99|5| 5:       s = svd(rand(n, n));
            |...|... |.| ...
        

Here we can see that the 5th line of the function has been called 200 times, for a total CPU time of 3.99 seconds (and an effort of 5 to interpret the line).

show_profile looks like to profile, but profile returns a matrix with the profiling results, while show_profile only prints that results to the console.

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);

// Prints the function profiling results to console
showprofile(foo)

See Also

History

VersionDescription
5.5.2 showprofile was removed after Scilab 5.5.2.

<< reset_profiling profiling bloc2exp >>