Installation guide

Profiling fo r Improving Performance
Using Profiling as a Debugging Tool
The Profiler is a useful tool for isolating problems in your M -f il es.
For example, if a particular section of the file did not run, you can look at the
detail reports to see what lines d id run, which might point y ou to the p roblem.
You c an also view the lines that did not run to help you develop test cases
that exercise that code.
If you get an error in the M-file when profiling, the Profiler provides partial
results in the reports. You can see what ran and w hat did not to help you
isolate the problem. Similarly, you can do this if you stop the execution using
Ctrl+C, which might be useful when a file is taking much more time to run
than expected.
UsingProfilingforUnderstandinganM-File
For lengthy M-files that you did not create or that you have not used for
awhile and are unfamiliar w ith, you can use the P rofiler to see how the M-file
actually worke d. Use th e Profil er detail repo r ts to see the lines actually called.
If there is an existing GUI tool (or M-file) similar to one that you want to
create, start profiling, use the tool, then stop profiling. L oo k th rou g h th e
Profiler detail reports to see what functions and lines ran. This helps you
determine the lines of code in the file that are most like the code you want
to create.
Using the Profiler
Use the Profiler to help you determ ine where you can modify y our code to
make performance improvements. The Profiler is a tool that shows you where
an M-file is spending its time. T his section covers
“Opening the Profiler” on page 7-30
“R unning the P rofiler” on page 7-30
“Profiling a G raphical User Interface” on page 7-32
“Profiling Statements from the Command Window” on page 7-33
“C hanging Fonts for the Profiler” on page 7-33
7-29