Programming and Data Types    

Viewing profile Results

There are two main ways to view profile results:

To save results, see Saving Profile Reports.

Viewing profile Reports.   To display profile results, type

This suspends profile and produces three reports:

The summary report appears in your system's default Web browser. Use the links at the top of the report page to see the other reports.

Summary profile Report.   The summary report presents statistics about the overall execution and provides summary statistics for each function called. Values reported include

Note that profile itself uses some time, which is included in the results.

Following is the summary report for the Lotka-Volterra model described in An Example Using profile.

Function Details profile Report.   The function details report provides statistics for the parent and child functions of a function, and reports the line numbers on which the most time was spent. Following is the detail report for the lotka function, which is one of the functions called in An Example Using profile.

Function Call History Profile Report.   The function call history displays the exact sequence of functions called. To view this report, you must have started profile using the -history option.

The profile function records up to 10,000 function entry and exit events. For more than 10,000 events, profile continues to record other profile statistics, but not the sequence of calls. Following is the history report generated from An Example Using profile.

Profile Plot.   To view a bar graph for the functions using the most execution time, type

This suspends the profile. The bar graph appears in a figure window. Following is the bar graph generated from An Example Using profile.

Saving Profile Reports.   When you generate the profile report, use the basename option to save it. For example,

saves the profile report to the file basename in the current directory. Later you can view the saved results using a Web browser.

Another way to save results is with the info = profile function, which displays a structure containing profile results. Save this structure so that later you can generate and view the profile report using profreport(info).

Example Using Structure of Profiler Results.   The profile results are stored in a structure that you can view or access. This example illustrates how you can view the results:

  1. Run profile for code that computes the Lotka-Volterra predator-prey population model.
  2. To view the structure containing profile results, type
  1. MATLAB returns

  1. You can view and access the contents of the structure. For example, type
  1. MATLAB displays the FunctionTable structure.

  1. To view the contents of an element in the FunctionTable structure, type, for example:
  1. MATLAB returns the second element in the structure.

  1. Save the results:
  2. In a later session, to generate the profile report using the saved results, type
  1. MATLAB displays the profile report.


  An Example Using profile Making Efficient Use of Memory