iOS CPU配置文件:为什么此线程会占用99.9%的CPU? [英] iOS CPU Profile: Why might this thread be sucking up 99.9% CPU?

查看:217
本文介绍了iOS CPU配置文件:为什么此线程会占用99.9%的CPU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当我加载一个表格视图时,除了让该表格视图显示之外,我没有故意执行任何活动,我将等待几秒钟,然后我的CPU使用率急剧上升.我如何找到原因?

Sometimes when I load a table view, and I'm performing no activity intentionally except letting the table view show, I'll wait a few seconds and then my CPU usage shoots up. How can I find the cause?

推荐答案

为什么这个线程会占用99.9%的CPU?

Why might this thread be sucking up 99.9% CPU?

我不知道.但是这里有一些想法:

I don't know. But here are some thoughts:

  1. 负责的库是UIKit.因此,似乎某些用户界面代码已损坏.
  2. 名为FreeContextStack的功能已经运行了很长时间.
  3. pthread_oncepthread_getspecific需要花费大量时间.这些功能速度很快,因此必须经常非常运行.
  4. 它们是GetContextStackPopContext
  5. 的一部分
  1. The responsible library is UIKit. So it seems that some user interface code is broken.
  2. A function named FreeContextStack is running for a long time.
  3. pthread_once and pthread_getspecific take a considerable amount of time. These functions are fast, so they have to run very often.
  4. They are part of GetContextStack and PopContext

似乎在您的代码中有某种上下文"堆栈被推送,但没有弹出.我会寻找UIGraphicsPushContextUIGraphicsBeginImageContext的出现,而没有它们的对口副本.

It seems that in your code there is some sort of "context" stack being pushed—but not popped. I'd look for occurrences of UIGraphicsPushContext or UIGraphicsBeginImageContext without their closing counterparts.

但是我可能完全不了解,这些功能不是图形上下文代码的一部分.

But I might be totally off and those functions are not part of graphics context code.

这篇关于iOS CPU配置文件:为什么此线程会占用99.9%的CPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆