<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>profile</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>july 2000</DATE>
  <SHORT_DESCRIPTION name="profile"> extract execution profiles of a Scilab function</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>c=profile(fun)  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>fun</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a Scilab function</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>c</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a nx3 matrix containig the execution profiles</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    To use <VERB>profile</VERB> the Scilab function must have been prepared for
    profiling (see getf).</P>
    <P>
    For such function, When such a function is executed the systems counts
    how many time each line is executed and how may cpu time is spend for
    each line execution. These data are stored within the function data
    structure.  The profile function allows to extract these data and
    return them in the two first columns of <VERB>c</VERB>. The <VERB>c</VERB> third
    column gives a measure of interpetor effort for one execution of
    corresponding line. Ith line of <VERB>c</VERB> corresponds to Ith line of the
    function (included first)</P>
    <P>
    Note that, due to the precision of the processor clock (typically one
    micro second), some executed lignes may appear with 0 cpu time even if
    total cpu time really spend in their execution is large.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
//define 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(10)
//get execution profiles
profile(foo)
//call the function
foo(20)
profile(foo) //execution profiles are cumulated
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>getf</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>deff</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>plotprofile</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>showprofile</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
