Is it possible to "time smaple" a C api app in the simulator?

Hi,

Is it possible to "time sample" a C Api application in the simulator ? i only see a LUA device in the time sample device menu for the simulator and i don't own a playdate myself. So i don't know if a real device is required for it or not or if it just is not possible to time sample C Api applications in the simulator

Thanks.

In the Simulator on macOS I see the option to sample C, but only with a connected device.

Ah so it might not be possible without a real device then.

does the playdate have a faster cpu than the arduboy ? i know my game is working on it (i just received my arduboy) and it's a port from the arduboy version. Maybe i should not need to worry so much about speed if cpu is faster or similar ?

C code is compiled to different architectures. For the Simulator that's Intel (only?) and for device it's ARM. So I think that's the reason you can only inspect using a device?

Playdate specs are at https://play.date

For the Simulator that's Intel (only?)

Sidenote, that can be controlled by DYLIB_FLAGS += -arch x86_64 -arch arm64 in the makefile (to make Universal builds intel + arm for M1 Macs for example).

1 Like

yes i'm aware of the different architecture, the question actually is why is it only possible to profile the code on the device itself ? why can i not profile the x86_64 code inside the simulator ? i know there exists debuggers / tools todo profiling for x86_64 code. Maybe it doesn't make much sense because the simulator does not run at the speed of the play date device and slow functions would be less noticeable due to it and it did not make sense then to also implement this feature in the simulator for c code. But then i wonder why LUA does have such option todo it in the simulator and C api build apps do not, if that was the case ?

Edit: i just noticed you don't need to the funtionality inside the simulator you can profile when building a debug version and running it from within the visual studio ide and then using the diagnostics tool to record cpu usuage and check the functions from the pdex.dll (your app)..

Maybe that's the real reason it was not needed ?

The C code performance you're getting on the simulator is somewhat indicative of where CPU time is spent but it's not accurate at all since you're not running the same code (different compilations, different optimisations) and not on the same CPU as the target. Just the fact that simulator code is not compiled as optimized will make drastic differences with relative performance between parts of the code.

Lua code's relative performance, on the other hand, is probably consistent between the simulator and the device.

That's right. I figured if you really want to profile a C game in the simulator you can use tools available for the OS. No need for us to reinvent the wheel.

1 Like