当前位置: 首页 > ds >正文

Android perfetto 工具使用

Android perfetto 工具简单使用

官方文档:https://developer.android.google.cn/tools/perfetto?hl=zh-cn

  1. perfetto 工具默认是关闭状态需要手动开启,可以从settings中开启或者写系统属性开启

adb shell setprop persist.traced.enable 1
  1. 开启后可查看服务是否启动:ps -A | grep traced

msm8953_64:/ # ps -A | grep traced
nobody       15225     1   52372   3024 poll_schedule_timeout 0 S traced
nobody       15226     1   52372   2904 poll_schedule_timeout 0 S traced_probes
msm8953_64:/ #
  1. 控制命令介绍

    控制命令解释备注
    –background | -d立即退出命令行界面,并继续在后台记录您的跟踪数据
    –config | -c自定义配置文件protobuf格式
    –out | -o保存的文件
    –dropbox TAGUpload trace into DropBox using tag TAG
    -t+time检测时长
    –no-guardrailsIgnore guardrails triggered when using --dropbox (for testing)
    –txtParse config as pbtxt. Not a stable API. Not for production use.
    –help | -h帮助
    –time | -tTrace duration N[s,m,h] (default: 10s)时长需要跟单位
    –buffer | -bRing buffer size N[mb,gb] (default: 32mb)
    –size | -sMax file size N[mb,gb] (default: in-memory ring-buffer only)
    ATRACE_CATRecord ATRACE_CAT (e.g. wm)
    FTRACE_GROUP/FTRACE_NAMERecord ftrace event (e.g. sched/sched_switch)
    FTRACE_GROUP/*Record all events in group (e.g. sched/*)
    –alert-idID of the alert that triggered this trace.
    –config-idID of the triggering config
    –subscription-idID of the subscription that triggered this trace
    –detach=keyDetach from the tracing session with the given key
    –attach=key [–stop]Re-attach to the session (optionally stop tracing once reattached)
    –is_detached=keyCheck if the session can be re-attached (0:Yes, 2:No, 1:Error)
  2. 常用模块介绍

    模块模块介绍
    sched跟踪CPU调度、上下文切换等内核事件‌
    freq记录CPU频率动态调整过程‌
    idle监控CPU进入/退出低功耗状态‌
    am追踪Activity启动、生命周期等应用管理事件‌
    wm记录窗口管理、Surface布局等图形层操作‌
    gfx分析UI渲染、VSync信号、GPU活动‌
    view跟踪View绘制、测量、布局流程‌
    binder_driver监控进程间通信的Binder调用‌
    hal记录Camera/Audio/Sensor等HAL层调用‌
    dalvik追踪ART/Dalvik的GC、JIT编译等事件‌
    camera分析相机开启、预览、拍照等流程耗时‌
    input记录触摸、按键等输入事件处理‌
    res跟踪内存/IO资源分配释放‌
    memory监控内存压力、OOM事件等‌

    如:perfetto -o /data/trace.perfetto-trace -t 10s sched freq idle am wm gfx view binder_driver hal dalvik camera input res memory

  3. 抓取指定的时候后会自动停止,将文件导出可在:https://ui.perfetto.dev/#!/record地址导入后查看

http://www.xdnf.cn/news/16128.html

相关文章:

  • 浅谈——游戏中的各种配置格式
  • Excel file format cannot be determined, you must specify an engine manually.
  • 【音视频协议篇】RTMP协议
  • 一、Vue概述以及快速入门
  • [IMX][UBoot] 16.Linux 内核移植
  • 智算中心光纤线缆如何实现自动化计算?
  • 初识卷积神经网络CNN
  • (12)机器学习小白入门YOLOv:YOLOv8-cls 模型微调实操
  • 为何在 Vue 的 v-model 指令中不能使用可选链(Optional Chaining)?
  • 开发浏览器插件-保存页面元素数据为json或csv
  • 2.9学习DOM和BOM (主要是获取元素的操作)
  • 苍穹外卖DAY10
  • 如何用 LUKS 和 cryptsetup 为 Linux 配置加密
  • Flink框架:keyBy实现按键逻辑分区
  • Linux物理地址空间入门:从硬件到内核内存的基石
  • 网络设备功能对照表
  • Pytorch张量
  • 云原生技术与应用-Kubernetes Pod调度基础
  • jdk25浅谈
  • 深度学习-常用环境配置
  • 使用 Tailwind CSS 控制元素在移动端不显示
  • MySQL 核心知识点梳理(2)
  • C++ 分配内存释放内存
  • 深度学习 ---神经网络以及数据准备
  • 清理磁盘空间
  • LiteCoT:难度感知的推理链压缩与高效蒸馏框架
  • NISP-PTE基础实操——代码审计
  • 从实践出发--探究C/C++空类的大小,真的是1吗?
  • 微店关键词搜索接口深度开发指南
  • 有关Maven的个人笔记总结