Sampling C on the Playdate hardware

Hi, my first experiment with building and running an entirely C program on Playdate is running at about 1 fps. I'm not really surprised by this, as I wrote a raytracer and I don't expect that to be appropriate for the hardware. Still, I'd like to get some CPU traces to figure out what specifically is taking up all the cycles.

The Sampler isn't really giving me the information I'm looking for. It seems to only show me Panic system entry points and none of my own functions. Is this expected? Do I need to port my C++ profiler to C? I don't really feel like doing that but I guess I will if I have to.

Thanks in advance!

2 Likes

If you're on the Mac, you can control-click the "Sample" button and select your games .elf file to get game symbols in the Sampler. If you're on linux/win, you'll need to wait a bit longer until we get a release out that contains this feature (it's ready to go, just needs to get out the door).

3 Likes

That's exactly what I was looking for, thank you!

(Also, fwiw that feels pretty hidden to me. I never would have known to do that. A "load elf" button would help in general).

Anyway thanks again.

2 Likes

We agree, it will be exposed in the UI in an up-coming update. :slight_smile: Furthermore, it will be added to the Windows/Linux Simulator and the behavior will be improved as well.

2 Likes

@willco I'm on an M1 Mac using the playdate simulator Version 2.1.1 (161138) and I can't get this to work. Control + Click on the sample button does nothing. Option + Click seems to let me switch the /bin folder where it looks for arm-none-eabi-addr2line. Did this change recently or is this something I'm doing wrong?

Edit: Oh my bad it has changed and been made more clear I just missed it. For anyone else reading you click on the dropdown which says "OS" and then you can add your games ELF