Reputation: 7304
Now that it's clear that the Cortex-A8 performance counters aren't available on the iPhone/iPad (they need to be explicitly enabled for usermode, which Apple hasn't done), is there some other way of getting a reasonable cycle count on iOS devices, for micro-profiling?
Upvotes: 4
Views: 941
Reputation: 104095
I might be completely off, but is CFAbsoluteTimeGetCurrent
too coarse for you?
Upvotes: 1
Reputation: 70733
The most fine grain timing available to iOS user code via a public API appears to be using mach_absolute_time(), from mach/mach_time.h, whose output appears to scaled results from one of the ASIC's clock cycle counters. Call it one extra time just before you start timing to pre-fill the ICACHE with the mach_time library code. Note that some of Apple's ASICs may shift gears for the app's CPU core clock speed, depending.
Upvotes: 3