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
    
  • 相关阅读:
    Cookie&Session会话跟踪技术
    JS前端数据多条件筛选(商品搜索)
    vue数据传递的特殊实现技巧
    Vue2.x directive自定义指令
    vue 自定义组件使用v-model
    Array.prototype.slice.call(arguments)探究
    webstorm快捷键汇总
    表单添加缩略图及截图js代码
    CSS水平垂直居中的几种方法
    下载页面判断客户端
  • 原文地址:https://www.cnblogs.com/bobfly1984/p/14090162.html
Copyright © 2011-2022 走看看