Stack sampling on device

I'm running some C code on the device and trying to figure out what I can do to make it faster. Unfortunately, I'm having trouble figuring out how to get the information I need from the tools available.

In this case, 99.7% of the time spent is in "hidden (pdpathfinder.c:568". Is this part of the API? Is there a way to tell where I'm calling this code from? Something like stack sampling would be really nice or, failing that, some of the source for the internal libraries would really help with debugging / profiling.

1 Like

The Simulator has a Sampler window, which can be set to measure Device instead of itself. The reported functions have disclosure triangles you can click to drill down, with code line numbers. Is that what you need?

1 Like

Thanks @AdamsImmersive. I was using that feature and that’s how I got this information.

It seems that I’m stuck in some API code?

I’d hoped to be able to get a stack sample so I can see where things are being called from.

So, I tried sampling another C program on the device and it doesn't show what I expected. This time it was the 3D Library example.

When running the sampler, the information you get out is not very detailed.

Is there another way to get more detailed traces out of the device? @dave maybe?


In the Mac Sim (only) if you control click the Sample button you can select the game's elf file. That will allow game symbols to show up in the sample. I am currently working on making this more obvious and also more useful by showing game and OS symbols together, among other things. I'm also adding game elf support to the Win/Linux sim. This will hopefully land in 1.13.1.

3 Likes

Thanks for this info! I tried this but I'm not sure it worked. I'm on an M1 Mac though so that may be why. I'll try on an intel device.

It would be great to have more sampling opportunities. I noticed that there's no JTAG or SWD header on the board. Are you guys willing to share the pinout of the test pads? I would definitely enjoy tracing my code to figure out how to make things go faster.

1 Like

Sorry, we have RDP enabled on the device so that people can't just connect and dump the firmware. We do need to try and keep some stuff protected for Catalog, and we're dreading the day China makes a Playdate clone that runs our code. Maybe it's overly paranoid, but we've invested a lot of time, energy, and money into Playdate and it's unsettling to think that our work could get sniped like that.

1 Like

Hey all, just wanted to follow up to see if seeing both user symbols and SDK symbols in the C sampler got added, I didn't see it in the 1.13.1/2 changelogs.

Thanks!

Not yet, hopefully it will make it into a release soon.

1 Like

kk no worries, just checking!