ftrace:仅打印trace_printk()的输出 [英] ftrace: Only print output of trace_printk()

查看:470
本文介绍了ftrace:仅打印trace_printk()的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以仅将 trace_printk()输出转储到 trace 文件中?我的意思是过滤掉函数跟踪器(或任何其他跟踪器)中的所有函数.

Is it possible to dump only trace_printk() outputs in trace file? I mean filter out all functions in function tracer (or any other tracer).

推荐答案

通常,您可以在选项目录/sys/kernel/debug/tracing/options 中关闭选项.使用 ls 显示所有可切换的选项.

In general, you can switch options off inside of the options directory, /sys/kernel/debug/tracing/options. Use ls to display all toggle-able options.

# ls
annotate     context-info     funcgraph-abstime   funcgraph-overhead  func_stack_trace  hex             overwrite        record-cmd  sym-offset       trace_printk
bin          disable_on_free  funcgraph-cpu       funcgraph-overrun   function-fork     irq-info        printk-msg-only  sleep-time  sym-userobj      userstacktrace
blk_classic  display-graph    funcgraph-duration  funcgraph-proc      function-trace    latency-format  print-parent     stacktrace  test_nop_accept  verbose
block        event-fork       funcgraph-irqs

通过 echo (即

echo -n"1">/sys/kernel/debug/tracing/options/trace_printk

如果您试图滤除 trace_printk()不会产生的任何输出,则可能需要确保 trace_printk()是唯一的选项集

If you are trying to filter out any output that was not produced by trace_printk(), you would likely need to ensure that trace_printk() is the only option set.

始终最好查看内核文档.怀疑.当我第一次学习ftrace时,还有一篇很棒的lwn文章对我有所帮助,称为 Ftrace函数跟踪器的秘密,其中通常包含一些有关过滤的部​​分.

It's always good to check out the kernel documentation when in doubt. There's also a great lwn article that helped me out when I was first learning ftrace called Secrets of the Ftrace function tracer, which includes some sections about filtering in general.

这篇关于ftrace:仅打印trace_printk()的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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