zoukankan      html  css  js  c++  java
  • 使用atrace抓取systrace log

    /system/etc/init/atrace.rc /system/bin/atrace
    mount debugfs
    atrace --list
    /sys/kernel/debug/tracing

    1:抓取atrace之前需要根据内存大小修改trace buffer size
    adb shell "echo 20960 > /sys/kernel/debug/tracing/buffer_size_kb"
    Recommends values:
    For 1G ram device: 4096
    For 2G ram device: 10960
    For 4G and above ram device: 20960

    2:run atrace background
    adb shell
    atrace -z -b 20960 -t 12 gfx input audio view webview wm am hal app res dalvik rs bionic
    power sched freq idle load sync workq memreclaim > /data/local/tmp/atrace.out &

    3:run atrace async mode
    Connect USB
    adb shell atrace --async_start -z -b 20960 gfx input audio view webview wm am hal app res
    dalvik rs bionic power sched freq idle load sync workq memreclaim
    Unplug USB and reproduce your issue
    Once issue get replicated, plugin USB immediately and run
    adb shell atrace --async_dump -z -b 20960 gfx input audio view webview wm am hal app res dalvik
    rs bionic power sched freq idle load sync workq memreclaim >atrace.out

    4:解析atrace
    python systrace.py --from-file 31off_atrace.out -o 31off_atrace.html

    5:配置内核模块trace events后,抓取atrace
    大多数内核模块都有trace配置,我们只需要开启 其trace event。

    adb root
    adb shell "echo > /d/tracing/set_event"
    adb shell "echo 0 > /sys/kernel/debug/tracing/tracing_on"
    adb shell "echo > /sys/kernel/debug/tracing/trace"
    adb shell "echo 20960 > /sys/kernel/debug/tracing/buffer_size_kb"
    
    adb shell "echo 1 > /proc/sys/kernel/sched_schedstats"
    adb shell "echo 1 > /sys/kernel/debug/tracing/events/sched/enable"
    adb shell "echo 1 > /sys/kernel/debug/tracing/events/f2fs/enable"
    
    adb shell "echo sched:*>> /sys/kernel/debug/tracing/set_event"
    adb shell "echo f2fs:*>> /sys/kernel/debug/tracing/set_event"
    
    adb shell "echo 512 > /sys/kernel/debug/tracing/saved_cmdlines_size"
    
    adb shell "echo 1 > /sys/kernel/debug/tracing/events/workqueue/enable"
    adb shell "echo 1 > /sys/kernel/debug/tracing/options/record-tgid"
    
    adb shell atrace -b 41920 -t 15 -z gfx irq input view webview wm am hal res rs bionic power sched freq idle disk pm dalvik network > C:UsersaiboDesktoplog31off_atrace.out
    
  • 相关阅读:
    设计模式之一(策略模式)
    电脑开机进入不了XP界面
    IBM X系列笔记本通过U盘安装系统方法全攻略
    DELPHI 访问其它电脑文件(局域网)
    笔记本维修小插曲 屏幕不亮处理方式
    delphi 笔记
    电脑小子的新婚夜
    如何得到动态链接库的输出函数(delphi tdump.exe)
    sql server重复数据处理
    如何使用jQuery向asp.net Mvc传递复杂json数据Filter篇
  • 原文地址:https://www.cnblogs.com/bobfly1984/p/14090162.html
Copyright © 2011-2022 走看看