本文介绍了Linux内核的ftrace输出格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android上的几个不同设备上使用了ftrace,但我注意到它们之间的输出格式有所不同.在某些情况下,包括当前进程的TGID,而在其他情况下,则不包括.

I'm using ftrace on Android on a couple of different devices, but I noticed that the output format differs between them. In some cases, the TGID of the current process is included, while in others, it is not.

TGID在我正在使用ftrace的当前应用程序中非常有用,我想知道如何启用它.我知道sysfs文件"/sys/kernel/debug/tracing/options/print-tgid",但是不幸的是,这在我的设备上不可用.是否有任何内核选项或ftrace句柄可用于将TGID添加到ftrace输出格式?

The TGID is very useful in the current application I'm using ftrace on, and I'm wondering how I could enable that. I'm aware of the sysfs file "/sys/kernel/debug/tracing/options/print-tgid", but this isn't available on my devices, unfortunately. Are there any kernel options or ftrace handles that can be used to add TGID to the ftrace output format?

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

vs

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

推荐答案

我查明了此功能的添加位置.仅Linux内核的Android分支的非常新的版本提供了tgid信息,而没有香草的Linux内核版本(我知道).如果您从 https://android.googlesource.com/kernel应用补丁/common/+/d34f20303f234fb6eae16548055766916cae7c2b%5E!/到内核源代码树并进行构建,应该进行设置.您可能需要手动应用补丁中的枚举,但是一旦添加枚举,就应该进行设置.

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). 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. You might have to manually apply the enums in the patch, but you should be set once this is added.

这篇关于Linux内核的ftrace输出格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 18:42