Linux kernel's ftrace output format

Deadly 提交于 2019-12-08 03:52:31

问题


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.

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!)

回答1:


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.



来源:https://stackoverflow.com/questions/26590513/linux-kernels-ftrace-output-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!