Android_005_systrace的抓取

python: 2.7.x
安装six模块:pip install six
位置: sdk/platform-tools/systrace

systrace 命令抓取:常用的抓取方法

$ python systrace.py \
-t 5 \  # 抓取5s
-a com.android.systemui \ # 跟踪此进程
-b 2048 \ #单位KB,跟踪缓冲区大小
-o systrace.html \ #输出trace文件名称
sched freq idle am wm gfx view binder_driver hal dalvik camera input res 
# 参数可用 -l查看
python systrace.py --list-categories
或
python systrace.py -l

xxx@xxx:~/Android/Sdk/platform-tools/systrace$ python systrace.py -l
         gfx - Graphics
       input - Input
        view - View System
     webview - WebView
          wm - Window Manager
          am - Activity Manager
          sm - Sync Manager
       audio - Audio
       video - Video
      camera - Camera
         hal - Hardware Modules
         res - Resource Loading
      dalvik - Dalvik VM
          rs - RenderScript
      bionic - Bionic C Library
       power - Power Management
          pm - Package Manager
          ss - System Server
    database - Database
     network - Network
         adb - ADB
    vibrator - Vibrator
        aidl - AIDL calls
       nnapi - NNAPI
         rro - Runtime Resource Overlay
         pdx - PDX services
       sched - CPU Scheduling
        freq - CPU Frequency
        idle - CPU Idle
        disk - Disk I/O
        sync - Synchronization
  memreclaim - Kernel Memory Reclaim
  binder_driver - Binder Kernel driver
  binder_lock - Binder global lock trace
         gfx - Graphics (HAL)
         ion - ION allocation (HAL)

NOTE: more categories may be available with adb root


atrace 脚本中使用的抓取方法
开始:

adb shell atrace -c -b 10240 --async_start -z gfx input view wm am sched load idle freq

停止:

adb shell atrace -c -b 10240 --async_stop -z gfx input view wm am sched load idle freq > atrace

转换为systrace.html:

python systrace.py --from-file atrace -o a.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值