Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Performances des programmes > profile


General information about instrumentation capabilities


prof = profileGetInfo()



A Scilab function.


The execution information of function.


These commands are used to profile a specific function within Scilab and get some execution information as Scilab values for further manipulation. Any Scilab function could be instrumented and function informations (static and after execution) are generated for each instrumented function independently. For more information on the prof value, see profileGetInfo.

The commands are used to setup and retrieve execution information. As the instrumentation information are accessible within Scilab you could define specific computation to report these numbers.

Basic example

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

// Returns the function profiling results
prof = profileGetInfo()

Basic example with a Scilab function

profileEnable(isempty)                 // instrument isempty()

isempty(1)                             // execute the function

prof = profileGetInfo()                // retrieve execution information

profileDisable(isempty)                // de-instrument isempty()

Display the 5th most executed lines

// instrument and execute as before
for i=1:1e5; isempty(i); end
prof = profileGetInfo();

// retrieve the function text
txt = mgetl(part(prof.FunctionTable.FileName, 1:($-3)) + "sci");
txt = txt(prof.FunctionTable.FirstLine:$);

// sort per execution time and display the corresponding lines
[B, k] = gsort(prof.LineCoverage(1)(:,2));
[string(k(1:5)) string(prof.LineCoverage(1)(k(1:5),2)), txt(k(1:5))]

See also

  • profileEnable — Add instrumentation to a function, a library or all available functions
  • profileDisable — Remove instrumentation from a function, a library or remove all instrumentation
  • profileGetInfo — Retrieve instrumentation information as a Scilab value
Report an issue
<< covWrite Performances des programmes profileDisable >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:50:46 CET 2020