如何找出mach_msg_trap等待什么? [英] How to find out what mach_msg_trap waits for?

查看:1329
本文介绍了如何找出mach_msg_trap等待什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目标上剖析我的iPhone应用程序,根据Instruments 65%的时间花在 mach_msg_trap



我有一个后台线程永远运行,并使用 performSelectorOnMainThread:withObject:waitUntilDone:,大约每2秒将结果发送回主线程。

解决方案

结果我的应用程序实际上并不花费65%的时间在 mach_msg_trap 函数。这是我的一个配置错误。



采样器工具默认为所有采样计数,这将测量所有线程,


I a profiling my iPhone application on target, and according to Instruments 65% of the time is spent in mach_msg_trap.

I have a background thread that runs-forever and send results back to the main thread using performSelectorOnMainThread:withObject:waitUntilDone:, aproximately every 2 seconds. I am not waiting until done.

解决方案

Turn out my app is not actually spending 65% of it's time in the mach_msg_trap function. It was a configuration error in Instruments on my part.

The Sampler tool defaults to All Sample Counts, this will measure all threads regardless of their state.

Instead switch to Running Sample Times that will reflect the current actual workload.

这篇关于如何找出mach_msg_trap等待什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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