我编写了一个基本的raytracer,并使用Grand Central Dispatch使用4个独立的渲染块并行计算像素。
这一切在Yosemite 10.10.1下的2014 MacBook Pro上都可以正常使用。现在,我第一次在新的iMac上启动了相同的应用程序,以检查速度是否有所提高。 (两个系统上的CPU都有4个内核。)突然,我在控制台日志中看到消息“线程捕获了正在燃烧的CPU”:
28.11.14 03:19:45,000 kernel[0]: process edXCG_hw3-Cocoa[510] thread 50878 caught burning CPU! It used more than 50% CPU (Actual recent usage: 97%) over 180 seconds. thread lifetime cpu usage 90.016272 seconds, (89.714813 user, 0.301459 system) ledger info: balance: 90003522038 credit: 90003522038 debit: 0 limit: 90000000000 (50%) period: 180000000000 time since last refill (ns): 91932078384
28.11.14 03:19:45,832 spindump[486]: Saved cpu_resource.diag report for edXCG_hw3-Cocoa version 1.0 (1) to /Library/Logs/DiagnosticReports/edXCG_hw3-Cocoa_2014-11-28-031945_Chriss-iMac.cpu_resource.diag
(我当时退出了该应用程序。)
现在我在想...
最佳答案
大量的热循环会缩短机器的生命周期,而与内部核心是否可以承受热量无关。
因此,我想您对适用于机器设计的热参数内的“最佳性能”感兴趣。
尝试将问题分解为较小的部分,并使用较低的Grand Central Dispatch“服务质量”设置,例如QOS_CLASS_UTILITY或QOS_CLASS_BACKGROUND。
较小的调度块和较低的“服务质量”设置将允许操作系统通过适当限制所需的队列调度率来管理相关的能源/热力/cpu负载。
WWDC2015 Session 718 "Building Responsive and Efficient Apps with GCD"简要讨论了相对于第一台无风扇Mac的上述方法。
Imagine you have an app … driving the machine hard, using a lot of energy and we need to help control that amount of energy in order to keep the machine at a reasonable temperature.
Well, what we can do is we can start to squeeze the amount of work we are going to do at the less important Quality of Service classes.
关于multithreading - 与GCD并行进行光线追踪时,线程捕获了正在燃烧的CPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188510/