Before a project's code is profiled, the MPLAB® REAL ICE™ in-circuit emulator settings need to be verified. Two settings are essential for code profiling to operate:
- Setting the MCU speed
- Enabling "Function Level Profiling" on the REAL ICE.
Setting the MCU Speed:
- Open the Project properties window (File>Project Properties).
- Click on “REAL ICE™” under “Categories” and select “Clock” from the “Option categories” drop-down box. Ensure this value matches the actual target speed as set by the configuration bits in code.
- Click Apply.
In some instances the MCU will run at the speed set but the data transfer from the device may not 'keep up'. It is possible to experience periodic speed reductions or pauses in program operation while the target is running during a profile session.
Enabling Function Level Profiling
From the Project Properties Window:
- Click on “REAL ICE” under “Categories” and select “Trace and Profiling” from the “Option categories” drop-down box.
- Under “Data Collection Selection”, select “Function Level Profiling”.
- Select a .log file and a desired length for the file which logs the profiled data
- Check “Include Time Stamp”. Two files are produced:
- a file containing raw polling and time stamp data (the log file)
- a file containing information about the log file, i.e., how to interpret the log file's contents (the .INX file)
- Click OK.