简体   繁体   English

iOS 11 CPU限制和空闲计时器

[英]iOS 11 CPU throttling and idle timer

On an iPhone SE, after an upgrade to iOS 11.4, I am now seeing a very strange CPU throttling result after about 8-10 seconds. 在iPhone SE上,升级到iOS 11.4后,我现在看到一个非常奇怪的CPU限制结果,大约8-10秒后。 I am using a very simple example app with (Deployment Target set to iOS 10.3) that displays a single view and does a decode operation inside a call to drawInMTKView. 我正在使用一个非常简单的示例应用程序(部署目标设置为iOS 10.3),它显示单个视图并在调用drawInMTKView时执行解码操作。 The CPU usage is as expected when the app starts (10-15%) but after an 8-10 second window the CPU seems to be massively throttled down so that a frame decode operation that was taking 4-5 ms at full CPU speed then takes 16-17 ms where (CPU usage is about 60%). 应用程序启动时CPU使用率与预期值(10-15%)相同,但在8-10秒窗口后,CPU似乎被大量限制,以便以全CPU速度运行4-5 ms的帧解码操作需要16-17 ms(CPU使用率约为60%)。 I attempted to disable any iOS idle timer by toggling the idleTimerDisabled flag, but this seems to have no effect on this. 我试图通过切换idleTimerDisabled标志来禁用任何iOS空闲计时器,但这似乎对此没有影响。 What is interesting is that rotating from Portrait to Landscape will reset this throttling and the decode will operate at full speed again until the 8-10 seconds of inactivity again throttles it down. 有趣的是,从纵向旋转到横向将重置此限制,并且解码将再次以全速运行,直到8-10秒的不活动再次限制它。 What could possibly be going on here? 这可能会发生什么? I have read that iOS 11 contains some new battery management code, but my device is new and the battery settings in General->Battery indicate that the device is operating at full speed. 我已经读过iOS 11包含一些新的电池管理代码,但我的设备是新的,General-> Battery中的电池设置表明设备正在全速运行。 Is there some other app flag or setting that can disable this throttling? 是否有其他应用程序标志或设置可以禁用此限制?

(full speed)
decode time 5.74 ms
decode time 5.87 ms
decode time 5.37 ms
decode time 5.81 ms
decode time 5.56 ms
decode time 5.97 ms

(after 8-10 second, reduced speed)
decode time 16.65 ms
decode time 16.65 ms
decode time 17.02 ms
decode time 16.49 ms
decode time 16.95 ms
decode time 16.03 ms

This may be relevant to your experience: we found that the act of profiling an app could fool these versions of iOS into downclocking when it was not appropriate. 这可能与您的体验有关:我们发现,对应用程序进行概要分析的行为可能会使这些版本的iOS在不合适时进入降频状态。 The problem did not occur in release builds not connected to the host PC. 未连接到主机PC的版本构建中未发生此问题。

We had an app whose render-loop ran in just under 8ms - well under the ~16ms needed for 60fps gameplay. 我们有一个应用程序,它的渲染循环运行时间不到8毫秒 - 远低于60fps游戏所需的~16ms。 When connected to the profiler, the target device would detect this and downclock - but the overhead of communicating with the profiler would push the frame time over 16ms, resulting in 30fps gameplay. 当连接到探查器时,目标设备将检测到这一点和倒计时 - 但与探查器通信的开销会将帧时间推迟超过16毫秒,从而产生30fps的游戏时间。

We found no solution to this other than recognising that it was happening and taking it into account. 除了认识到它正在发生并将其考虑在内之外,我们没有找到解决方案。 When we added additional render load to the app, pushing it past 8ms, the problem went away because the target device no longer downclocked. 当我们向应用程序添加额外的渲染负载时,将其推迟超过8毫秒,问题就消失了,因为目标设备不再降频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM