加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用adb 命令(atrace)抓起systrace的方法。

发布时间:2020-12-15 23:13:47 所属栏目:安全 来源:网络整理
导读:adb shell atrace -c -b 10240 --async_start -z gfx 1. 执行查看adb shell atrace 功能 atrace --h atrace: invalid option -- husage: atrace [options] [categories...]options include: -a appname enable app-level tracing for a comma separated list
adb shell atrace -c -b 10240 --async_start -z gfx 

1. 执行查看adb shell atrace 功能

atrace --h
atrace: invalid option -- h

usage: atrace [options] [categories...]
options include:
  -a appname      enable app-level tracing for a comma separated list of cmdlines; * is a wildcard matching any process
  -b N            use a trace buffer size of N KB
  -c              trace into a circular buffer
  -f filename     use the categories written in a file as space-separated
                    values in a line
  -k fname,...    trace the listed kernel functions
  -n              ignore signals
  -s N            sleep for N seconds before tracing [default 0]
  -t N            trace for N seconds [default 5]
  -z              compress the trace dump
  --async_start   start circular trace and return immediately
  --async_dump    dump the current contents of circular trace buffer
  --async_stop    stop tracing and dump the current contents of circular
                    trace buffer
  --stream        stream trace to stdout as it enters the trace buffer
                    Note: this can take significant CPU time,and is best
                    used for measuring things that are not affected by
                    CPU performance,like pagecache usage.
  --list_categories
                  list the available tracing categories
 -o filename      write the trace to the specified file instead
                    of stdout.
 atrace --list_categories 列出连接设备可用的跟踪类别参数(后面分析会看到这些参数)。
 atrace --list_categories
         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
         pdx - PDX services
       sched - CPU Scheduling
         irq - IRQ Events
         i2c - I2C Events
        freq - CPU Frequency
        idle - CPU Idle
        disk - Disk I/O
         mmc - eMMC commands
        load - CPU Load
        sync - Synchronization
       workq - Kernel Workqueues
  memreclaim - Kernel Memory Reclaim
  regulators - Voltage and Current Regulators
  binder_driver - Binder Kernel driver
  binder_lock - Binder global lock trace
   pagecache - Page cache

1.普通抓取方法

adb shell "atrace gfx -b 20480 -t 1 | grep xxx/xxx.SGameActivity"

2.指向文件输出使用

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 > d:/trace_raw

或者
adb shell "atrace gfx -b 20480 -t 1 | grep xxx/xxx.SGameActivity" > d:/trace_raw

3.不间断循环抓取

开始:
adb shell atrace -c -b 10240 --async_start gfx

执行循环输出
adb shell atrace -c -b 10240 --async_dump gfx

停止
adb shell atrace -c -b 10240 --async_stop

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读