
Profiling fo r Improving Performance
7 To save the profile report, use the profsave function. This function stores
the profile information in separate H TML files, for each function listed in
FunctionTable of p.
profsave(p)
By default, profsave puts these HTML files in a subdirectory of the
current directory named
profile_results, and displays the summary
report in your system browser. You can specify another directory name as
an optional second argum ent to
profsave.
Accessing Profiler Results
The profile function returns results in a str ucture. This example illustrates
how you can access these results:
1 To start profile,specifyingthedetail and history options, type in the
Command Window.
profile on -detail builtin -history
The detail option specifies that built-ins should be included in the profile
data. The history option specifies that the report include information about
the sequence of functions as they are entered and exited during profiling.
2 Execute an M-file. T his example runs the Lotka-Volterra predator-prey
population model. For more inf ormation ab out this mode l, type
lotkademo,
which runs a dem onstration.
[t,y] = ode23('lotka',[0 2],[20;20]);
3 Stop profiling.
profile off
4 Get the structure containing profile results.
stats = profile('info')
stats =
FunctionTable: [43x1 struct]
FunctionHistory: [2x754 double]
ClockPrecision: 3.3333e-010
7-45
Commentaires sur ces manuels