Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語 -

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
However, this page did not exist in the previous stable version.

Справка Scilab >> Функции > profiling > showprofile


Outputs the function profiling results to the console

Calling Sequence




a Scilab function


To use showprofile 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 has been executed, calling showprofile outputs to the console the profiling results.

Each printed line contains the profiling results for the corresponding function line (including the header line of the function). That includes the number of calls, the total CPU time spent in that line, a measurement of the interpretor effort to interpret the line, and the source code of that line. An example of output:

            |1   |0    |0| function x=fun(n)
            |1   |0    |0|   if n > 0 then
            |1   |0    |2|     x = 0;
            |200 |0.01 |0|     for k = 1:n
            |200 |3.99 |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.

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.


// 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);
    x = [];

// Enables the profiling of the function

// Executes the function

// Prints the function profiling results to console

See Also

  • add_profiling — Enables the profiling of a function
  • profile — Returns the profiling results of a function
  • plotprofile — Displays the profiling charts of a function
  • reset_profiling — Resets profiling counters of a function.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Fri Apr 11 14:19:50 CEST 2014