Firmware engineer at Semihalf. coreboot and libpayload unit-tests maintainer. Now involved with extending futility functionality to support a wider range of BIOS image signing options, as well as with developing coreboot profiler and accompanying tools.
coreboot has to be lightning-fast, and developers are contributing a lot of their time to achieve lower and lower execution times. Without proper tools, however, it is hard to find some bottlenecks and improve inefficient code.
In coreboot there is a timestamps system, which allows one to mark the start and end of a particular period, store time points (in CBMEM), and analyze them later on. It is a useful, yet inefficient approach, as it requires manual placement in the code. There is a place for code profilers - powerful tools helping with such tasks, without requiring much manual work from developers.
Commonly available code profiling tools - like gprof - are not suitable for the coreboot environment, that may not provide resources like timers/interrupts required for sampling. There is another way to measure execution time - here the code instrumentation comes to the rescue. It provides a mechanism for injecting entry and exit handlers for functions, which can be coded to store exact times. With this in place, we can analyze samples stored in CBMEM in many ways - for example, by creating flame chart visualizations.
This talk will focus on the design and implementation proposals of a coreboot code profiler capable of running on a real device, as well as on proof-of-concept implementation with an exemplary output of such a tool. We will also go through the technical details and issues which arose during development with a presentation of solutions to these problems.