# profile

extract execution profiles of a Scilab function

## Calling Sequence

    c=profile(fun)

## Arguments

fun

  a Scilab function

c

  a nx3 matrix containig the execution profiles

## Description

To use `profile`, profiling instructions need to be added to the Scilab function function by add_profiling.

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 `c`. The `c` third column gives a measure of interpetor effort for one execution of corresponding line. Ith line of `c` corresponds to Ith line of the function (included first)

Note that, due to the precision of the processor clock (typically one micro second), some executed lines may appear with 0 cpu time even if total cpu time really spend in their execution is large.

## Examples

    function x=foo(a, n)
     x=0;
     for i=1:n
       if x<10 then
         x=x+a
       else
         x=x+1
       end
     end
     x=x^2+1
    endfunction

    add_profiling("foo")
    foo(0.1,100) //run the function
    profile(foo) //extract profile information

## See Also

- add_profiling
- deff
- plotprofile
- showprofile