了解iPhone OpenGL分析 [英] Understanding iPhone OpenGL Profiling

查看:177
本文介绍了了解iPhone OpenGL分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用已启动并正在运行,现在我正在寻求提高渲染性能。使用'仪器'我收集了一些数据。我正在使用旧版iPhone 3G作为最糟糕的情况。

My app is up and running and now I am looking to improve the rendering performance. Using 'Instruments' I have collected some data. I am working with an old iPhone 3G as a worst case senario.

Time Profiler:

Time Profiler:

-30%    CopyVertexElementsMultipleSequential
-11%    mach_msg_trap
-4%     _semwait_signal
-2%     ValidateState

然而,使用Open GL ES驱动程序,采样器读取:

However using the Open GL ES Driver, the Sampler reads:

-70%    _semwait_signal
-24%    CopyVertexElementsMultipleSequential
-0.7%   mach_msg_trap

戳我无法提供的文档是OpenGL ES Sampler和Timer Profiler之间的区别。任何人都可以启发我吗?

Poking around the docs I haven't been able to come with what what the difference between the OpenGL ES Sampler and the Timer Profiler are. Can anyone enlighten me?

推荐答案

首先,这只是你正在看的采样器乐器。 OpenGL ES Driver模板只包含Sampler仪器和OpenGL ES Driver。它与OpenGL ES没有任何特殊之处。

First, that's just the Sampler instrument you're looking at. The OpenGL ES Driver template simply includes the Sampler instrument along with the OpenGL ES Driver one. It doesn't have anything special to do with OpenGL ES.

采样器仪器和Time Profiler在收集数据方面有所不同。来自仪器用户指南

The Sampler instrument and the Time Profiler differ in the way they gather data. From the Instruments User Guide:


Time Profiler仪器和
采样器仪器类似,但
存在一些差异:

The Time Profiler instrument and the Sampler instrument are similar, but there are some differences:


  • Time Profiler以相同的方式收集回溯数据作为Shark,来自
    内核空间。另一个
    手上的采样器从用户空间收集数据。
    因此,Time Profiler在收集
    数据时比Sampler更有效

  • Time Profiler gathers backtrace data in the same manner as Shark, from kernel space. Sampler, on the other hand, gathers data from user space. Consequently, Time Profiler is more efficient than Sampler at gathering data.

注意:Time Profiler(和Shark)如果
目标进程被优化为省略
帧指针,则可以产生不准确的回溯数据。

Note: Time Profiler (and Shark) can yield inaccurate backtrace data if the target process is optimized to omit frame pointers.

Time Profiler可以从一个收集数据或所有过程。采样器只能
采样一个进程。

Time Profiler can gather data from one or all processes. Sampler can only sample a single process.

Time Profiler只能采样所有线程状态或运行线程。
Sampler总是对所有线程
状态进行采样。通常,您对运行线程感兴趣
。当您的
应用程序挂起时,您希望
检查所有线程状态。

Time Profiler can sample all thread states or running threads only. Sampler always samples all thread states. Generally, you’re interested in running threads. When your application is hung, you want to examine all thread states.

我更喜欢自己使用Time Profiler,通过适当的数据挖掘,如向其来电者收费库或方法。

I prefer to use Time Profiler myself, with appropriate data mining like charging libraries or methods to their callers.

关于剖析OpenGL ES在应用程序中,您首先要查看可以在OpenGL ES Driver仪器中启用的各种统计信息。单击仪器名称右侧的 i 以显示弹出窗口,然后单击配置以显示可以记录的可能统计信息的列表。特别是,请查看Tiler Utilization和Renderer Utilization统计信息。启用您想要的,返回上一个屏幕,然后单击复选框以确保它们已被记录。

In regards to profiling an OpenGL ES application, you'll want to look first at the various statistics that you can enable in the OpenGL ES Driver instrument. Click the i to the right of the instrument name to bring up a popup, then click Configure to show a list of possible statistics you can log. In particular, look at the Tiler Utilization and Renderer Utilization stats. Enable the ones you want, go back to the previous screen, and click the checkboxes to make sure they're logged.

如果您的应用程序最大化Tiler利用率统计,你是受到几何尺寸的限制。尽你所能减少这一点(使用我提到的一些提示这里)你将看到性能的显着提升。另一方面,如果您达到最大渲染器利用率,则您的填充率受限,您可能需要关闭MSAA,调整片段着色器(如果在OpenGL ES 2.0上),或者缩小区域大小你正在渲染,除其他外。

If your application maxes out the Tiler Utilization stat, you are being limited by the size of your geometry. Do what you can to reduce that (using some of the tips I mention here) and you'll see a significant boost in performance. On the other hand, if you're hitting a Renderer Utilization max, you're fill-rate limited and you may need to turn off MSAA, tune your fragment shaders (if on OpenGL ES 2.0), or reduce the size of the area you're rendering, among other things.

除此之外,在iOS 4.0的设备上运行你的应用程序,并使用Xcode 4附带的新OpenGL ES Analyzer仪器该工具非常适合在渲染代码中建议热点,或者在冗余状态调用等情况下浪费性能。

Beyond that, run your application on a device that's on iOS 4.0 and use the new OpenGL ES Analyzer instrument that comes with Xcode 4. That instrument is great for suggesting hotspots in your rendering code, or wasted performance from redundant state calls, etc.

查看特定的跟踪数据,看来你是花费大量时间将几何体复制到GPU。我会看一下使用顶点缓冲对象(VBO)来显着减少它。

Looking at your specific trace data, it appears that you are spending an awful lot of time copying geometry to the GPU. I'd look at using a vertex buffer object (VBO) to significantly reduce that.

这篇关于了解iPhone OpenGL分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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