Datasheet

Emulator User’s Guide for MPLAB X IDE
DS52085A-page 62 2013 Microchip Technology Inc.
6.4 PC SAMPLING
PC sampling is a method for examining C code to determine how much time is spent
in each function. This information can show you where your program time is being
spent so you may work to optimize your code.
For PC sampling, a device timer is set up to take samples of program execution and
display the results in the PC profiling window.
PC profiling is similar to PC sampling. For details see Section 7.5 “PC Profiling”.
Currently, to use PC sampling your project must be set up for:
a 16-bit device
the MPLAB XC16 C Compiler version 1.10 or above
To perform sampling:
1. Open the Project properties window (File>Project Properties
).
2. Click on “REAL ICE” under “Categories” and select “Trace and Profiling” from the
“Options categories” drop-down box.
3. Under “Data Collection Selection”, select “PC Sampling”.
4. Set up your data file and timer in this window. For reference, see
Section 11.3.1 Trace and Profiling”. Then click OK.
5. Select Window>Debugging>PC Profiling
. This will open the PC Profiling window.
6. Run your code and then halt.
7. View the sampling data in the window. Data is only displayed on halt.
8. Right click in the window to pop up a menu to either clear the data or reload the
data.
FIGURE 6-3: PC SAMPLING SELECTION AND SETUP