Navigation

Operators and Keywords

Function List:

C++ API

: profshow (data)
: profshow (data, n)
: profshow ()
: profshow (n)

Display flat per-function profiler results.

Print out profiler data (execution time, number of calls) for the most critical n functions. The results are sorted in descending order by the total time spent in each function. If n is unspecified it defaults to 20.

The input data is the structure returned by profile ("info"). If unspecified, profshow will use the current profile dataset.

The attribute column displays ‘R’ for recursive functions, and is blank for all other function types.

See also: profexplore, profile.

Demonstration 1

The following code

 profile on;
 A = rand (100);
 B = expm (A);
 profile off;
 T = profile ("info");
 profshow (T, 10);

Produces the following output

# Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
  40    sqrtm             0.072      31.81            2
   2     expm             0.053      23.45            6
  26 binary *             0.038      16.69           96
  32 binary ^             0.026      11.43           12
  35 binary \             0.014       6.17            6
  33 binary +             0.011       4.72           49
   1     rand             0.006       2.76            6
  27  balance             0.003       1.23            6
  24 binary /             0.001       0.44           12
  28     norm             0.001       0.39            6

Demonstration 2

The following code

 profile on;
 expm (rand (500) + eye (500));
 profile off;
 profshow (profile ("info"), 5);

Produces the following output

# Function Attr     Time (s)   Time (%)        Calls
-------------------------------------------------------
   2     expm             0.099      29.51            7
  40    sqrtm             0.072      21.39            2
  26 binary *             0.072      21.28          112
  32 binary ^             0.031       9.32           14
  35 binary \             0.026       7.59            7

Package: octave