简体   繁体   English

Linux内核的ftrace输出格式

[英]Linux kernel's ftrace output format

I'm using ftrace on Android on a couple of different devices, but I noticed that the output format differs between them. 我在Android上的几个不同设备上使用了ftrace,但我注意到它们之间的输出格式有所不同。 In some cases, the TGID of the current process is included, while in others, it is not. 在某些情况下,包括当前进程的TGID,而在其他情况下,则不包括。

The TGID is very useful in the current application I'm using ftrace on, and I'm wondering how I could enable that. TGID在我正在使用ftrace on的当前应用程序中非常有用,我想知道如何启用它。 I'm aware of the sysfs file "/sys/kernel/debug/tracing/options/print-tgid", but this isn't available on my devices, unfortunately. 我知道sysfs文件“ / sys / kernel / debug / tracing / options / print-tgid”,但是不幸的是,这在我的设备上不可用。 Are there any kernel options or ftrace handles that can be used to add TGID to the ftrace output format? 是否有任何内核选项或ftrace句柄可用于将TGID添加到ftrace输出格式?

#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
#                    ^^ (no tgid...)

vs VS

#                                      _-----=> irqs-off
#                                     / _----=> need-resched
#                                    | / _---=> hardirq/softirq
#                                    || / _--=> preempt-depth
#                                    ||| /     delay
#           TASK-PID    TGID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |        |      |   ||||       |         |
#                        ^^^(tgid is available in this column!)

I pinpointed where this functionality was added. 我查明了此功能的添加位置。 Only very new versions of the Android branch of the linux kernel have tgid info available, and no vanilla Linux kernel versions (that I'm aware of). 只有Linux内核的Android分支的非常新的版本可以使用tgid信息,而没有香草的Linux内核版本(我知道)。 If you apply the patch from https://android.googlesource.com/kernel/common/+/d34f20303f234fb6eae16548055766916cae7c2b%5E!/ to the kernel source tree and build, you should be set. 如果您将https://android.googlesource.com/kernel/common/+/d34f20303f234fb6eae16548055766916cae7c2b%5E!/中的补丁应用到内核源代码树并进行构建,则应该进行设置。 You might have to manually apply the enums in the patch, but you should be set once this is added. 您可能必须手动应用修补程序中的枚举,但是添加后应进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM