Android的Systrace跟踪文件格式 [英] Android Systrace Trace File Format

查看:1633
本文介绍了Android的Systrace跟踪文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安卓 systrace 工具,来电的 atrace 通过ADB工具。但是,我不很了解的痕迹文件的格式。显然,这是非常相似的Linux ftrace 工具有一些不同。主要的区别是不使用的的System.map 文件,但它包含了所有的信息到跟踪文件。另外,还有一些新的B |是Android的特定电子邮件的条目

Android systrace tool, calls atrace tool via ADB. However, I don't understand very well the format of the traces file. Apparently it is very similar to linux ftrace tool with some differences. The main difference is that is doesn't uses a System.Map file but it includes all that information into the trace file. Also, there are new B|E entries that are android specific.

有关于这种格式在Android源$ C ​​$ C的一些信息:<一href="http://androidxref.com/4.1.1/xref/external/chromium-trace/src/tracing/linux_perf_importer.js">http://androidxref.com/4.1.1/xref/external/chromium-trace/src/tracing/linux_perf_importer.js

There is some information about this format in Android Source Code at: http://androidxref.com/4.1.1/xref/external/chromium-trace/src/tracing/linux_perf_importer.js

不过,该文档中,我们可以读取的格式属于Linux的 PERF 工具。我不这么认为,Linux的PERF给作为输出一个非常不同的格式...(除非一些特殊的配置有效......)

However, in that documentation we can read that the format belongs to Linux Perf Tool. I don't think so, linux perf gives as an output a very different format... (unless some special configuration is active...)

我的问题是:是否有人知道我在哪里可以找到有关与生成的机器人跟踪文件的正式文件的 atrace 从ADB工具

My question is: Does anybody know where can I found an official documentation about android trace files generated with atrace tool from adb?

这是格式熟悉吗?

# tracer: nop
#
# entries-in-buffer/entries-written: 66427/66427   #P:2
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
          atrace-1724  [000] d..3 14186.680000: sched_switch: prev_comm=atrace prev_pid=1724 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120
          <idle>-0     [000] d.h7 14186.690000: sched_wakeup: comm=tfm_b6bcf800 pid=1714 prio=35 success=1 target_cpu=000
          <idle>-0     [000] d..3 14186.690000: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=tfm_b6bcf800 next_pid=1714 next_prio=35
    tfm_b6bcf800-1714  [000] d..3 14186.690000: sched_switch: prev_comm=tfm_b6bcf800 prev_pid=1714 prev_prio=35 prev_state=D|W ==> next_comm=swapper/0 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.690000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.690000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35
 Player Aud Mixe-146   [001] d..3 14186.690000: sched_switch: prev_comm=Player Aud Mixe prev_pid=146 prev_prio=35 prev_state=D ==> next_comm=swapper/1 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.690000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.690000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35
 Player Aud Mixe-146   [001] d..3 14186.690000: sched_switch: prev_comm=Player Aud Mixe prev_pid=146 prev_prio=35 prev_state=S ==> next_comm=swapper/1 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.700000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.700000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35
  EventThread-110   [001] d..5 14190.100000: sched_wakeup: comm=SurfaceFlinger pid=103 prio=112 success=1 target_cpu=001
     EventThread-110   [001] d..3 14190.100000: sched_switch: prev_comm=EventThread prev_pid=110 prev_prio=111 prev_state=S ==> next_comm=SurfaceFlinger next_pid=103 next_prio=112
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|onMessageReceived
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|handleTransaction
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|doTransaction
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|handleMessageInvalidate
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|onMessageReceived
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|handleMessageRefresh
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|rebuildLayerStacks
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|computeVisibleRegions
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: E
  SurfaceFlinger-103   [001] ...1 14190.100000: tracing_mark_write: B|96|doComposition
  SurfaceFlinger-103   [001] d.h4 14190.100000: sched_wakeup: comm=surfaceflinger pid=96 prio=120 success=1 target_cpu=001
  SurfaceFlinger-103   [001] d..3 14190.100000: sched_switch: prev_comm=SurfaceFlinger prev_pid=103 prev_prio=112 prev_state=R ==> next_comm=surfaceflinger next_pid=96 next_prio=120

在此先感谢!

Thanks in advance !

推荐答案

好了,现在是肯定的:格式属于 ftrace 工具。安卓 atrace 是一个扩展的 ftrace 构建以方便配置。

Well, now it is sure: the format belongs to ftrace tool. Android atrace is an extension of ftrace build to facilitate configuration.

从官方文档的 ftrace ,表明该输出格式可以直接通过它通过以下方式产生:

The official documentation from ftrace, shows that this output format can directly be produced by it in the following way:

root@adroid:# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
root@adroid:# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# cat /sys/kernel/debug/tracing/trace > mytracefile.txt
root@adroid:# echo 0 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# echo 0 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable

官方文档: <一href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/trace/ftrace.txt" rel="nofollow">http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/trace/ftrace.txt

Official Documentation at: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/trace/ftrace.txt

# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 77/77   #P:8
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
          <idle>-0     [007] d...  2440.707395: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=snapshot-test-2 next_pid=2243 next_prio=120
 snapshot-test-2-2229  [002] d...  2440.707438: sched_switch: prev_comm=snapshot-test-2 prev_pid=2229 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120
[...]

问候,

这篇关于Android的Systrace跟踪文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆