是否有适用于iPhone应用程序的非采样时间分析工具? [英] Are there non-sampling time-profiling tools for iPhone apps?

查看:40
本文介绍了是否有适用于iPhone应用程序的非采样时间分析工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试通过Instruments和Shark对iPhone应用程序进行配置,但是它们都通过定期获取线程堆栈的屏幕快照来使用数据采样方法.

I have tried Instruments and Shark to profile an iPhone app, but both use a data sampling approach, by regularly taking screenshots of thread stacks.

我希望有一个全面的性能分析工具,该工具可以记录每个函数调用以及函数及其子例程所花费的时间.从直觉上讲,这似乎比获取样本更好.Windows上的AQtime之类的东西会很棒.

I would prefer to have a full coverage profiling tool, which would record every single function call and the time spent in functions and their subroutines. This seems intuitively better than getting samples. Something like AQtime on Windows would be great.

所以我的问题是:

  1. 基于样本的分析是否可以被信任并且与基于函数调用的分析一样有用?
  2. Instruments或Shark可以进行这种类型的分析吗?
  3. 是否还有其他工具更接近我想要的?

推荐答案

我发现Shark所使用的时间剖析对于确定代码中的瓶颈非常准确.您可以通过使用 Config |显示|最小配置编辑器来调整采样间隔,以更细化.显示Mini Config Editor 并减少采样时间.

I've found that the time profiling used by Shark is very accurate for determining what your bottlenecks are in your code. You can adjust the sampling interval to be more fine-grained by showing the Mini Config editor using Config | Show Mini Config Editor and lowering the sample time.

Xcode 3.2中的乐器现在也具有不错的Time Profiler乐器,尽管它仅适用于Mac.我发现Instruments可以很好地进行性能分析,但是如果系统负载很大,它可能会掉落样品.通常,考虑到它的易用性,我首先从Instruments开始,然后如果需要更详细的了解,请转到Shark.

Instruments in Xcode 3.2 also now has a nice Time Profiler instrument, although that's Mac-only. I've found that Instruments works well for profiling, but it can drop samples if the system is under heavy load. Generally, I start with Instruments, given how easy it is to use, then move on to Shark if I need a more detailed view of what's going on.

如果您真的想进行基于函数调用的分析,那么我将看一下DTrace.我写了几篇有关使用DTrace调整Cocoa应用程序的文章

If you really want to do function-call-based profiling, I'd look at DTrace. I've written a couple of articles about tuning Cocoa applications using DTrace here and here. The latter one even shows an example of tuning the startup time of an iPhone application using a custom DTrace script.

不幸的是,DTrace当前无法在iPhone本身上运行,但是您仍然可以通过在模拟器中运行应用程序来使用它收集很多有趣的信息.尽管确切的时序信息远不及设备上的时序信息,但确切地知道执行了多少次方法以及按什么顺序执行的方法可以提供一些关于优化位置的线索.我使用DTrace对Shark and Instruments收集的信息提供了不同的看法,并回答了有关我的应用程序的特定问题.

Unfortunately, DTrace currently does not run on the iPhone itself, but you can still gather a lot of interesting information using it by running your application in the simulator. While the exact timing information will be nowhere near what it is on the device, knowing exactly what methods are executed how many times and in what order can give some clues as to where to optimize. I use DTrace to provide a different perspective on information gathered by Shark and Instruments, and to answer specific questions about my application.

这篇关于是否有适用于iPhone应用程序的非采样时间分析工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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