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 > plotprofile


Displays the profiling charts of a function

Calling Sequence




a Scilab compiled function, or a function name (string), or an array of function names


To use plotprofile 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 plotprofile displays two windows, one containing the source code of the function, and a second one containing three histograms which show:

  • the number of calls of each line

  • the total CPU time spent on each line (in seconds)

  • a measure of effort to interpret each line (arbitrary unit)

When clicking on a histogram bin, the related line is highlighted in the source code window.

Note: "Exit" item is used to exit from the "plotprofile" graphics window.


// Exemple of profiling a function
function foo()
  runs = 50;
  b = 0;
  for i = 1:runs
      b = zeros(220, 220);
      for j = 1:220
           for k = 1:220
               b(k,j) = abs(j - k) + 1;

// Enables the profiling of the function

// Executes the function

// Displays the profiling charts
plotprofile(foo) // click on Exit to exit
// Exemple of profiling a function defined with deff
deff('x = foo2(n)', ['if n > 0 then'
                    '  x = 0;'
                    '  for k = 1:n'
                    '    s = svd(rand(n, n));'
                    '    x = x + s(1);'
                    '  end'
                    '  x = [];'
                    'end'], ..

// Executes the function

// Displays the profiling charts
plotprofile("foo2") // click on Exit to exit

See Also

  • add_profiling — Enables the profiling of a function
  • profile — Returns the profiling results of a function
  • showprofile — Outputs the function profiling results to the console
  • 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