Profiling (Embedded)

Notes on profiling embedded systems.

openocd has a profile command, which samples the program counter. Apparently needs latest git version - it's not in release yet.

Command: profile seconds filename [start end]

Profiling samples the CPU’s program counter as quickly as possible, which is useful for non-intrusive stochastic profiling. Saves up to 1000000 samples in filename using “gmon.out” format. Optional start and end parameters allow to limit the address range.

This file can be inspected with gprof.

https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html#SEC4