Cannot get CPU frequency in iOS 5?

元气小坏坏 提交于 2019-12-24 04:13:06

问题


This used to work in iOS 5 but does not seem to work any longer:

unsigned freq;
mib[0] = CTL_HW;
mib[1] = HW_CPU_FREQ;
sysctl (mib, 2, &freq, (void*) &len, NULL, 0);

Does anybody know an alternative?

Thanks.


回答1:


Apple doesn't provide the CPU frequency for all hardware. For example, it was unknown for some time exactly what the clock rate for the A4 in the iPod touch 4g was.

I think the best you can do is determine what the device is, and construct a lookup table with the CPU frequencies you can find on wikipedia and so on. Then, if you can't probe the CPU frequency, look it up in the lookup table.



来源:https://stackoverflow.com/questions/8291357/cannot-get-cpu-frequency-in-ios-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!