문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

I might be completely off, but is CFAbsoluteTimeGetCurrent too coarse for you?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top