Mapping callgrind addresses using symbols.db

Hi folks,

I’m doing some performance profiling of on the Simulator using Valgrind + Callgrind + KCachegrind. This is working fine in terms of collecting data, but I’m running into friction when trying to map hot callgraph nodes back to Playdate SDK symbols.

In Callgrind/KCachegrind I’m seeing a lot of hot frames coming from the SDK itself. I know the SDK ships with symbols.db, which contains address ranges for internal SDK functions. Is there a simple workflow for mapping profiler output back to symbols.db?

I’m not debugging crashes here. This is purely for performance profiling and understanding SDK hotspots.

Thanks!

Edit: Let me also add, if it’s helpful, here is the section of the dump that I’m looking in to:

Where I know that the first function call into the SDK is playdate.sprite.drawSprites

symbols.db gives addresses for SDK functions in the device firmware, to symbolize crash logs and sample traces. That won't help you at all on the simulator side. The simulator's sampler can show you timing for Lua code running in it, though I don't know how well that maps to device performance. I don't expect that profiling the simulator (even if you had symbols) would give much insight into how it runs on the hardware.

Ah, of course. I had hoped the simulator would at least give me signal for optimizing in the right direction. For example, if setAlwayRedraw has an impact. And for some reason, I got it into my head that the ‘hw_id’ field included a variant for the simulator.