Heap Tracing
Heap Tracing allows tracing of code that allocates or frees memory. More information is available in the heap tracing documentation. Please also review System Behavior Analysis for SystemView tracing configuration.
Let’s open an ESP-IDF project. For this tutorial, we will use the system/sysview_tracing_heap_log example.
Navigate to
View>Command Palette.Type
ESP-IDF: New Project, select the command, and choose the ESP-IDF version to use.Note
If you don’t see the option, please review the setup in Install ESP-IDF and Tools.
A window will open with settings to configure the project. You can later choose from a list of ESP-IDF examples. Go to the
systemsection and choosesysview_tracing_heap_log. You will see aCreate Project Using Example sysview_tracing_heap_logbutton at the top and a description of the project below. Click the button, and the project will open in a new window.
In this example, the project is already configured for application tracing.
Note
For more information, please refer to Application Level Tracing Library.
Configure, build, and flash your project as explained in the Build Your Project.
Note
The OpenOCD server output is shown in the menu
View>Output>ESP-IDF.Make sure that OpenOCD configuration files are properly set with the the
ESP-IDF: Select OpenOCD Board Configurationcommand.
First, click
ESP-IDF Explorerin the Visual Studio Code Activity Bar. Second, in theESP-IDF APP TRACERsection, clickStart Heap Trace. This will execute the extension’s OpenOCD server and send the corresponding tracing commands to generate a tracing log. Third, you can see the generated tracing log in theAPP TRACE ARCHIVESnamedHeap Trace Log #1.Each time you execute
Start Heap Trace, a new trace will be generated and shown in the archives list. You can also start tracing by running theESP-IDF: App Tracecommand.
Click
Heap Trace Log #1and choose theHeap Tracingoption for theESP-IDF Tracingreport window. Click theShow Reportbutton to reload the visualization.
Click
Heap Trace Log #1and choose theSystemView Tracingoption for theESP-IDF System View Reportwindow.