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

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

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

Aide Scilab >> Fonctions avancées > profiling > plotprofile

plotprofile

extracts and displays execution profiles of a Scilab function

Calling Sequence

plotprofile(fun)

Arguments

fun

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

Description

To use plotprofile, the Scilab function must have been prepared for profiling (see exec).

When such a function is executed, the system counts how many times each line is executed and how much cpu time is spent executing each line. This data is stored within the function data structure. The function plotprofile in an interactive command which displays this results in a graphic window. When a line is clicked, the source of the function is displayed with the selected line highlighted.

NOTE: you have to click on the "Exit" item in the graphics windows to exit from "plotprofile".

The function code is regenerated with fun2string and dumped into a temporary file.

Examples

//define a function and prepare it for profiling
deff('x=foo(n)',['if n==0 then'
                 '  x=[]'
                 'else'
                 '  x=0'
                 '  for k=1:n'
                 '    s=svd(rand(n+10,n+10))'
                 '    x=x+s(1)'
                 '  end'
                 'end'],'p')
//call the function
foo(30)

//get execution profiles
plotprofile(foo) // click on Exit to exit
// with the exec function
tmpfile = TMPDIR + "/myFunction.sci";
mputl(["function myFunction()"
       "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;"
       "      end"
       "    end"
       "end"
       "endfunction"], tmpfile);

exec(tmpfile)
add_profiling("myFunction");
myFunction();

//get execution profiles
plotprofile(myFunction) // click on Exit to exit

See Also

  • profile — extract execution profiles of a Scilab function
  • showprofile — extracts and displays execution profiles of a Scilab function
  • fun2string — generates ascii definition of a scilab function
Report an issue
<< reset_profiling profiling profile >>

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 Apr 02 17:36:48 CEST 2013