Navigation

Operators and Keywords

Function List:

C++ API

Function File: profshow (data)
Function File: profshow (data, n)
Function File: profshow ()
Function File: 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
-------------------------------------------------------
  26 binary *             0.026      89.94           16
   2     expm             0.001       4.48            1
  35 binary \             0.001       1.93            1
  32 binary ^             0.000       0.97            2
  33 binary +             0.000       0.95            8
   1     rand             0.000       0.56            1
  27  balance             0.000       0.21            1
  37  profile             0.000       0.18            1
  16    trace             0.000       0.17            1
  24 binary /             0.000       0.14            2

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
-------------------------------------------------------
   4     expm             0.229      39.95            1
  27 binary *             0.148      25.88           16
  35 binary \             0.116      20.28            1
   3 binary +             0.040       6.98            9
  33 binary ^             0.016       2.77            2

Package: octave