Measure Graphics Performance

测量的图形性能Measure Graphics Performance

在iOS应用程序中广泛使用图形可以使你的应用脱颖而出。但是,除非你负责任地使用图形资源,否则你的应用程序会慢下来,降低电池寿命,看起来平庸,不管你想渲染的内容有多好。最佳图形性能:Extensive use of graphics in your iOS app can make your app stand out from your competitors. But unless you use graphics resources responsibly, your app will slow down, reduce battery life, and look mediocre no matter how good the content you are trying to render. For optimal graphic performance:

  • 确保动画的帧速率足以提供流畅的视觉体验,而不会对应用程序性能产生负面影响。Ensure that the frame rate of animations is sufficient for providing a fluid visual experience without negatively impacting app performance.
  • 减少应用程序使用的视图数量。Reduce the number of views your app uses.
  • 减少不透明性的使用,例如在显示半透明模糊的视图中。如果您需要使用不透明性,请避免在频繁更新的视图上使用它。否则,能源成本被放大,因为无论内容变化,背景视图和半透明视图都必须更新。Reduce the use of opacity, such as in views that exhibit a translucent blur. If you need to use opacity, avoid using it over views that are updated frequently. Otherwise, energy cost is magnified, as both the background view and the translucent view must be updated whenever content changes.
  • 绘制到屏幕的较小部分,只有变化的部分。要做到这一点,使用needstodrawrect:或getrectsbeingdrawn:计数:确定具体地区的更新,并把结果drawRect:。Draw to smaller portions of the screen—only the portions that are changing. To do this, use needsToDrawRect: or getRectsBeingDrawn:count: to identify the specific area to update, and pass the result to drawRect:.
  • 消除图当你的应用程序或其内容是不可见的;例如,当应用程序在后台,或当其含量是其他观点,遮挡裁剪,或画外。Eliminate drawing when your app or its content is not visible; for example, when your app is in the background, or when its content is obscured by other views, clipped, or offscreen.
  • 在窗口大小调整期间消除绘图。Eliminate drawing during window resizing.

在iOS中测量核心动画图形性能Measure Core Animation Graphics Performance in iOS

核心动画剖析模板使用核心动画和时间分析器工具来测量iOS应用程序的图形和CPU性能。此模板提供了一个快速轻量级的起点,用于测量应用程序每秒呈现的帧数。它允许您快速查看应用程序呈现的帧比预期的少。通过关联您在取样时所做的工作,您可以识别需要优化的代码区域。The Core Animation profiling template uses the Core Animation and Time Profiler instruments to measure your iOS app’s graphics and CPU performance. This template provides a quick and lightweight starting point for measuring the number of frames per second rendered by your app. It allows you to quickly see where your app renders fewer frames than expected. By correlating what you were doing at the time the sample was taken, you can identify areas of your code that need to be optimized.

NOTE

使用核心动画模板对物理设备上的应用程序进行概要分析。在iOS模拟器中分析应用程序并不能产生真实的真实结果。Use the Core Animation template to profile an app on a physical device. Profiling an app in iOS Simulator does not produce true real-world results.

不要使用核心动画工具测量opengl的ES性能。Do not use the Core Animation instrument to measure OpenGL ES performance.

帧速率测量To measure frame rate

  1. 把你的iOS设备连接到你的Mac。Connect your iOS device to your Mac.
  2. 运载工具。Launch Instruments.
  3. 在出现的分析模板选择对话框中,单击“核心动画”。In the profiling template selection dialog that appears, click Core Animation.
  4. 从目标设备和流程列表中选择iOS设备和应用程序。Choose your iOS device and app from the target device and process lists.
  5. 单击“选择”创建跟踪文档。Click Choose to create a trace document.
  6. 单击“记录”按钮在工具栏(或按command-r)开始记录。Click the Record button () in the toolbar (or press Command-R) to begin recording.
  7. 正常使用你的应用程序。Use your app normally.
  8. 请单击“停止”按钮,或按command-r再次,当完成。Click the Stop button (), or press Command-R again, when complete.
  9. 检查收集的数据。Examine the collected data.

    详细窗格显示每个记录样本的帧速率。The detail pane shows the frame rate for each recorded sample.

与结果相互关联Correlate Interactions with Results

在用核心动画工具捕获数据后,您可能会看到时间轴窗格中的尖峰,其中应用程序的帧速率明显变好。然而,在某些情况下,通过改变横向和正常方向之间的设备,可能会导致尖峰,如果你不知道,你可能会花时间试图找出导致性能增加的原因。与结果交互关联的一种方法是在执行某些事件时向时间轴插入标志。查看设置标志。After capturing data with the Core Animation instrument, you may see spikes in the timeline pane where the frame rate of the app becomes appreciably better. In some cases, however, spikes can be caused by changing the device between landscape and normal orientation—and if you don’t know this, you might spend time trying to find what caused the performance increase. One way to correlate interactions with results is to insert flags into the timeline when you performed certain events. See Set Flags.

调试选项Debugging Options

核心动画包含了一些有用的调试选项,在“显示面板”的显示设置区域中。您不需要运行跟踪来在iOS设备上使用这些选项。Core Animation contains a number of useful debugging options in the display settings area of the inspector pane. You do not need to be running a trace to use these options on your iOS device.

  • 混色层。显示混合视图层。在混合的顶部绘制的混合视图可以用红色高亮显示。当选择此选项时,减少应用程序中红色的数量,可以显著提高应用程序的性能。混合视图层常常导致表滚动缓慢。Color Blended Layers. Shows blended view layers. Multiple view layers that are drawn on top of each other with blending enabled are highlighted in red. Reducing the amount of red in your app when this option is selected can dramatically improve your app’s performance. Blended view layers often cause slow table scrolling.
  • 颜色绿色,红色。用绿色或红色标记视图。一种观点认为,能够使用缓存的光栅化标为绿色。Color Hits Green and Misses Red. Marks views in green or red. A view that is able to use a cached rasterization is marked in green.
  • 彩色复制图像。显示由核心动画以蓝色复制的图像。Color Copied Images. Shows images that are copied by Core Animation in blue.
  • 颜色立即。删除执行彩色刷新操作时的10毫秒延迟。Color Immediately. Removes the 10 ms delay when performing color-flush operations.
  • 颜色不一致图像。在源像素与目标像素不对齐的图像上放置一个洋红叠加。Color Misaligned Images. Places a magenta overlay over images where the source pixels are not aligned to the destination pixels.
  • 彩色屏幕呈现黄色。在内容呈现画外黄色覆盖。Color Offscreen-Rendered Yellow. Places a yellow overlay over content that is rendered offscreen.
  • 彩色快速路径蓝。在内容,从排序分离蓝色覆盖。Color OpenGL Fast Path Blue. Places a blue overlay over content that is detached from the compositor.
  • 闪存更新区域。当图形处理器更新这些区域时,你的iOS设备上的颜色区域是黄色的。Flash Updated Regions. Colors regions on your iOS device in yellow when those regions are updated by the graphics processor.

OpenGL是衡量activity inMeasure OpenGL Activity in iOS

OpenGL ES分析模板使用OpenGL ES分析器和GPU驱动工具来测量和分析iOS应用程序中的OpenGL ES活动,以检测正确性和性能问题。它还建议如何解决发现的问题。The OpenGL ES Analysis profiling template uses the OpenGL ES Analyzer and GPU Driver instruments to measure and analyze OpenGL ES activity in your iOS app in order to detect correctness and performance problems. It also recommends how to address found problems.

测量opengl活动To measure OpenGL Activity 

  1. 把你的iOS设备连接到你的Mac。Connect your iOS device to your Mac.
  2. 运载工具。Launch Instruments.
  3. 在出现的分析模板选择对话框中,单击opengl ES分析。In the profiling template selection dialog that appears, click OpenGL ES Analysis.
  4. 从目标设备和流程列表中选择iOS设备和应用程序。Choose your iOS device and app from the target device and process lists.
  5. 单击“选择”创建跟踪文档。Click Choose to create a trace document.
  6. 单击“记录”按钮在工具栏(或按command-r)开始记录。Click the Record button () in the toolbar (or press Command-R) to begin recording.
  7. 使用你的应用程序,锻炼你的OpenGL ES图形代码。Use your app normally, exercising your OpenGL ES graphics code.
  8. 几秒钟后,测试,请单击“停止”按钮,或再次按下command-r。After a few seconds of measurement, click the Stop button (), or press Command-R again.
  9. 检查收集的数据。Examine the collected data.

错误在详细窗格中列出,按其严重程度排序。红色方块表示最严重的问题,橙色三角形表示较不严重的问题。在详细窗格中选定的问题中,在“检查窗格”的扩展详细区域中显示一个建议和堆栈跟踪。Errors are listed in the detail pane sorted by their severity. Red squares indicate the most severe problems, and orange triangles indicate less severe problems. A recommendation and the stack trace are displayed in the extended detail area of the inspector pane for the issue selected in the detail pane.

时间: 2024-10-11 23:15:20

Measure Graphics Performance的相关文章

Unity3D Optimizing Graphics Performance for iOS

原地址:http://blog.sina.com.cn/s/blog_72b936d801013ptr.html icense Comparisons http://unity3d.com/unity/licenses#iphone Optimizing Graphics Performance http://unity3d.com/support/documentation/Manual/Optimizing Graphics Performance.html iOS A useful bac

Measure Java Performance – Sampling or Instrumentation

copy from https://blog.codecentric.de/en/2011/10/measure-java-performance-sampling-or-instrumentation/ In recent discussions, I noticed a confusion about the differences between measuring with Sampling andInstrumentation.I hear about which one should

Designing for iOS: Graphics & Performance

http://robots.thoughtbot.com/designing-for-ios-graphics-performance  [原文] In the previous article, we explored different techniques to customize the look and feel of UIButton, assigning to each a difficulty level based on the complexity of the Object

Performance Tuning

本文译自Wikipedia的Performance tuning词条,原词条中的不少链接和扩展内容非常值得一读,翻译过程中暴露了个人工程学思想和英语水平的不足,翻译后的内容也失去很多准确性和丰富性,需要在之后的时间继续细读. Performance Tuning特指计算机系统的性能优化工作.它通常是根据某个现实或潜在的性能问题而发起的.绝大部分系统都会因为负载的升高而导致性能下降,一个系统对于负载的可承受能力称为可扩展性(scalability),调整系统使其可以承受更大的负载就是perform

Optimizing Item Import Performance in Oracle Product Hub/Inventory

APPLIES TO: Oracle Product Hub - Version 12.1.1 to 12.1.1 [Release 12.1] Oracle Inventory Management - Version 12.1.1 to 12.1.1 [Release 12.1] Oracle Item Master - Version 12.0.6 to 12.0.6 [Release 12] Information in this document applies to any plat

DYNAMIC CONTEXT SWITCHING BETWEEN ARCHITECTURALLY DISTINCT GRAPHICS PROCESSORS

FIELD OF INVENTION This invention relates to computer graphics processing, and more specifically to computer graphics processing using two or more architecturally distinct graphics processors. BACKGROUND OF INVENTION Many computing devices utilize hi

Performance --- 前端性能监控

阅读目录 一:什么是Performance? 二:使用 performance.timing 来计算值 三:前端性能如何优化? 四:Performance中方法 五:使用performane编写小工具 回到顶部 一:什么是Performance? Performance是前端性能监控的API.它可以检测页面中的性能,W3C性能小组引入进来的一个新的API,它可以检测到白屏时间.首屏时间.用户可操作的时间节点,页面总下载的时间.DNS查询的时间.TCP链接的时间等.因此我们下面来学习下这个API.

Performance Profiling Zeebe

转自:https://zeebe.io/blog/2019/12/zeebe-performance-profiling/ by Josh Wulf and Klaus Nji on Dec 22 2019 in BenchmarksPerformance. We frequently get questions about Zeebe’s performance. The answer to any performance question is easy: “It depends”. In

A Full Hardware Guide to Deep Learning

A Full Hardware Guide to Deep Learning Deep Learning is very computationally intensive, so you will need a fast CPU with many cores, right? Or is it maybe wasteful to buy a fast CPU? One of the worst things you can do when building a deep learning sy