Click on the image to get to the video tutorial:
I made a library which serves as a lightweight and easy to use alternative to profiling tools like percepio tracealyzer or segger systemview. Profiling is a crucial step in optimizing performance and tracking down synchronisation issues or bugs in multitasking applications.
It doesn’t require any external tools (except for a browser) and is very easy to add to any existing project, whether it’s in Arduino IDE, ESP-IDF or PlatformIO.
The video starts with a quick overview and then goes into the details of the different features (watch it in 1080p if you want to be able to read the code and text labels in the traces), but the quick-start guide goes as follows:
- Either add
lib_deps = mabuware/mabutrace
to yourplatformio.ini
file if you have aframework = arduino
project, or add anidf_component.yml
manifest file with a dependency onmabuware/mabutrace
if you have aframework = espidf
project - Include
mabutrace.h
in the implementation files containing the functions you want to profile - Initialize mabutrace by calling
mabutrace_init();
andmabutrace_start_server(81);
- Insert the
TRC();
macro at the top of the most important routines of your application - Compile and launch your application
- Go to
http://(your_IP):81/
and click on “Capture Trace” - Either click on “Save Trace” and then open it in “chrome://tracing” if you are using the chrome browser, or click on “Open Trace in Perfetto” otherwise
In case you give this library a try, I would very welcome feedback if you encountered any issues but also if it helped you in some way optimize your app. If you are already familiar with chrome://tracing or with Perfetto and are missing some important features that would be supported by the front end, I’ll be happy to look into adding these features.
Also I’m not making video tutorials too often so if you have feedback in particular about the video tutorial itself, whether you find it too repetitive or too confusing, this will be appreciated too.
Finally if you are facing performance problems with your app and need help, feel free to contact me.