I need to calculate the time a piece of my code takes to execute, right now I'm using clock_t like this:
clock_t start = clock(); float executionTime = (clock()-(float)start) / CLOCKS_PER_SEC;
This works in the simulator, but when launched on the device, the value is always less than it should be. When you start the simulator and my device at the same time, the simulator ends first, but when my device ends, it has a shorter runtime.
The only difference between the simulator code and the device code is that a couple of functions are written in the ARM assembly for the device.
In case it matters im using Xcode 4.1 and iOS 4.3.
source share