systrace简介
简介
systrace是给予内核ftrace机制来实现的一套trace工具,android上层实现了Trace类,用于把trace信息写入ftrace buffer,最后再通过ftrace buffer抓取出来。因此想要使用systrace,必须设备使能了ftrace功能。另外User版本的固件不可以抓trace,userdebug和eng的固件才可以抓。
systrace在Android SDK中有包含这套工具:android-sdk-linux/platform-tools/systrace,主要是调用其中的systrace.py脚本来抓取数据。
systrace.py 命令参数
-h, --help show this help message and exit-o FILE write HTML to FILE-t N, --time=N trace for N seconds-b N, --buf-size=N use a trace buffer size of N KB-k KFUNCS, --ktrace=KFUNCSspecify a comma-separated list of kernel functions totrace-l, --list-categorieslist the available categories and exit-a APP_NAME, --app=APP_NAMEenable application-level tracing for comma-separatedlist of app cmdlines--no-fix-threads don't fix missing or truncated thread names--no-fix-tgids Do not run extra commands to restore missing thread tothread group id mappings.--no-fix-circular don't fix truncated circular traces--no-compress Tell the device not to send the trace data incompressed form.--link-assets (deprecated)--boot reboot the device with tracing during boot enabled.The report is created by hitting Ctrl+C after thedevice has booted up.--from-file=FROM_FILEread the trace from a file (compressed) rather thanrunning a live trace--asset-dir=ASSET_DIR(deprecated)-e DEVICE_SERIAL, --serial=DEVICE_SERIALadb device serial number--agent-dirs=AGENT_DIRSthe directories of additional systrace agent modules.The directories should be comma separated, e.g.,--agent-dirs=dir1,dir2,dir3. Directory |agents| is thedefault agent directory and will always be checked.--target=TARGET chose tracing target (android or linux)
categories
systrace可用的策略如下所示:
gfx - Graphicsinput - Inputview - View Systemwebview - WebViewwm - Window Manageram - Activity Managersm - Sync Manageraudio - Audiovideo - Videocamera - Camerahal - Hardware Modulesres - Resource Loadingdalvik - Dalvik VMrs - RenderScriptbionic - Bionic C Librarypower - Power Managementpm - Package Managerss - System Serverdatabase - Databasenetwork - Networkadb - ADBvibrator - Vibratoraidl - AIDL callspdx - PDX servicessched - CPU Schedulingirq - IRQ Eventsi2c - I2C Eventsfreq - CPU Frequencyidle - CPU Idledisk - Disk I/Osync - Synchronizationworkq - Kernel Workqueuesmemreclaim - Kernel Memory Reclaimregulators - Voltage and Current Regulatorsbinder_driver - Binder Kernel driverbinder_lock - Binder global lock tracepagecache - Page cache
命令实例
抓取一段8s的systrace log:
python systrace.py -b 16384 -t 8 gfx input view webview sm hal idle freq sched wm am res dalvik -o test_trace.html
输出结果到test_trace.html,只能使用chrome浏览器双击打开。我们也可以在浏览器中输入:
chrome://tracing/
然后load对应的trace文件。
systrace简介相关推荐
- Android:通过systrace进行性能分析及使用-详细
Android:通过systrace进行性能分析 https://www.cnblogs.com/blogs-of-lxl/p/10926824.html 一.Systrace 简介 Systrace ...
- btrace 开源!基于 Systrace 高性能 Trace 工具
介绍 btrace(又名 RheaTrace) 是抖音基础技术团队自研的一款高性能 Android Trace 工具,它基于 Systrace 实现,并针对 Systrace 不足之处加以改进,核心改 ...
- Android Systrace 基础知识(10) - Binder 和锁竞争解读
本文是 Systrace 系列文章的第十篇,主要是对 Systrace 中的 Binder 和锁信息进行简单介绍,简单介绍了 Binder 的情况,介绍了 Systrace 中 Binder 通信的表 ...
- 启动速度与执行效率优化项目实战(五):Systrace与TraceView工具
一.SysTrace简介 Systrace允许你监视和跟踪Android系统的行为(trace).它会告诉你系统都在哪些工作上花费时间.CPU周期都用在哪里,甚至你可以看到每个线程.进程在指定时间内都 ...
- Android Systrace 基础知识(9)-MainThread 和 RenderThread 解读
本文是 Systrace 系列文章的第九篇,主要是是介绍 Android App 中的 MainThread 和 RenderThread,也就是大家熟悉的「主线程」和「渲染线程」.文章会从 Syst ...
- Systrace 工具
一.概述 1.Systrace简介 Systrace(System Trace)是 Android 4.1 之后,引入的分析设备性能的主要工具.它实际上是其它工具的封装容器(是atrace的主机端封装 ...
- systrace分析
收集到的systrace系列文章目录 Android Systrace 基础知识 -- Systrace 简介 · Android Performance
- Android 系统性能优化(80)---Android性能优化:这是一份详细的布局优化 指南(含lt;includegt;、lt;Viewstubgt;、lt;mergegt;)
Android性能优化:这是一份详细的布局优化 指南(含<include>.<Viewstub>.<merge>) 前言 在 Android开发中,性能优化策略十分 ...
- Android系统性能优化(68)---绘制优化
Android性能优化: 绘制优化 前言 在 Android开发中,性能优化策略十分重要 本文主要讲解性能优化中的绘制优化,希望你们会喜欢. 目录 1. 影响的性能 绘制性能的好坏 主要影响 :And ...
- Android 性能优化---(7)布局优化
Android性能优化:布局优化 详细解析 前言 在 Android开发中,性能优化策略十分重要 本文主要讲解性能优化中的布局优化,希望你们会喜欢. 目录 1. 影响的性能 布局性能的好坏 主要影响 ...
最新文章
- Oracle Study之--Oracle 11g RAC故障(Failed to create or upgrade OLR)
- 我的Java开发学习之旅------Java经典排序算法之希尔排序
- android 判断当前application 是在前台还是在后台
- 组件库实战 | 用vue3+ts实现全局Header和列表数据渲染ColumnList
- 11.6 ConfigParser模块
- JDBC ResultSet分析
- Golang 入门系列(六)理解Go中的协程(Goroutine)
- python第四章选择题_PythonCrashCourse 第四章习题
- SQL Server 2016下载及安装教程
- C语言 冒泡排序 程序流程图,C语言冒泡排序及流程图(思路解析)
- VBR、ABR、CBR三种编码方式
- ſ xf(sinx)dx 中的f(sinx)到底是什么
- 关于C++、PHP和Swoole-韩天峰
- mysql explain不准确_mysql explain预估剖析
- 菜鸟应用-手机应用在线制作平台,手机应用,APP开发,手机软件开发
- dvwa详解_DVWA(六):XSS-Reflected 反射型XSS全等级详解
- 以管理为轴心 为IT服务保驾护航——北京赛特百货有限公司
- Android 多语言支持
- ESB+MDM预置样例测试总结
- 程序猿生存指南-56 前路漫漫
热门文章
- 偏最小二乘法(NIPALS经典实现--未简化)
- 数据分析从零到精通第一课 数据分析技巧和OLAP工具简介
- 【JavaWeb学习】14综合案例
- presscad图层LIsp_PressCADLisp程序说明
- 高分二号影像数据预处理及裁剪过程
- 能盾智能化应急响应管理平台
- wallhaven怎么下原图_Wallhaven Top高清壁纸抓取工具
- 电脑无线连接打印机(DCP-1618W)
- 计算机无本地安全策略,如何打开本地安全策略、如何解决“未授予用户在此计算机上的请求登录类型”...
- 【Matter】解密Matter协议(一)--- 什么是Matter协议?