google 官方教程学习之UI性能优化( Analyzing UI Performance with Systrace)

Systrace工具帮助开发者分析Android应用的UI性能,通过收集和检查系统及应用的执行时间信息,以每秒60帧为目标,找出导致性能问题的原因。它展示各线程、进程的执行情况,突出显示潜在问题并提供解决方案。生成追踪报告后,使用浏览器打开HTML文件,通过画面分析、警报检查等方法定位和修复UI性能问题。
摘要由CSDN通过智能技术生成

更多分享请看http://www.cherylgood.cn
- While developing your application, you should check that user interactions are buttery smooth, running at a consistent 60 frames per second. If something goes wrong, and a frame gets dropped, the first step in fixing the problem is understanding what the system is doing.

  • 在开发你的应用时,你应该检查用户交互时时候平滑流畅,界面是否以每秒60帧的速度刷新。 如果出现问题,并且帧被丢弃,解决问题的第一步就是了解系统正在做什么。

  • The Systrace tool allows you to collect and inspect timing information across an entire Android device, which is called a trace. It shows where time and CPU cycles are being spent, displaying what each thread and process is doing at any given time. It also inpects the captured tracing information to highlight problems that it observes, from list item recycling to rendering content, and provide recommendations about how to fix them. This document explains how to navigate the trace files produced by the tool, and use them to analyze the performance of an application’s user interface (UI).

  • Systrace工具可以允许你去收集并查看每个时间段内整个Android设备的信息,这称为跟踪。 它显示某个点花费的时间和CPU执行的周期时间,显示每个线程和进程在任何时间内正在做什么。 它还可以查看捕获到的跟踪信息并且突出显示从列表项目回收到呈现内容的问题,提供有关如何解决这些问题的建议。 本文档介绍如何使用工具生成的跟踪文件,并使用它们来分析应用程序用户界面(UI)的性能。

Overview


  • Systrace helps you analyze how the execution of your application fits into the many running systems on an Android device. It puts together system and application thread execution on a common timeline. In order to analyze your app with Systrace, you first collect a trace log of your app, and the system activity. The generated trace allows you to view highly detailed, interactive reports showing everything happening in the system for the traced duration.

  • Systrace可帮助你分析应用程序的执行情况以及如何适配Android设备上正在运行的不同版本的系统。 它系统和应用程序线程放在公共时间轴上的一起执行。 为了使用Systrace分析你的应用,你首先收集应用程序的跟踪日志和系统活动。 生成的跟踪允能够让你查看到非常详细在系统中跟踪的持续时间内发生的所有事件的交互式报告。

Uploading System Trace_138631.png ...]

  • shows a trace captured while scrolling an app that is not rendering smoothly. By default, a zoomed out view of the traced duration is shown. The horizontal axis is time, and trace events are grouped by process, and then by thread on the vertical axis.

- 上图显示在滚动未平滑渲染的应用程序时捕获的跟踪信息。 默认情况下,显示跟踪的持续时间的缩小视图。 水平轴是时间,跟踪事件按进程分组,然后通过垂直轴上的线程进行分组。

  • The groupings are in the order Kernel, SurfaceFlinger (the android compositor process), followed by apps, each labeled by package name. Each app process contains all of the tracing signals from each thread it contains, including a hierarchy of high level tracing events based on the enabled tracing categories.

分组分别按照内核,SurfaceFlinger(Android合成器进程)的顺序,后面是应用程序,每个都用程序包名称做标记。 每个应用进程都包含其内部的每个线程的所有跟踪信号,包括一个基于开启的跟踪类别的高级跟踪事件的层次结构。

Generating a Trace 生成追踪报告


  • In order to create a trace of your application, you must perform a few setup steps. First, you must have a device running Android 4.1 (API 16) or higher. Set up the device for debugging, connect it to your development system, and install your application. Some types of trace information, specifically disk activity and kernel work queues, require that you have root access to the device. However, most Systrace log dat

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值