Linux事件存储快照在哪里?

时间:2017-08-03 23:22:11

标签: linux linux-kernel

我正在尝试根据kernel documentation收集事件快照。

- snapshot

  This command causes a snapshot to be triggered whenever the
  triggering event occurs.

  The following command creates a snapshot every time a block request
  queue is unplugged with a depth > 1.  If you were tracing a set of
  events or functions at the time, the snapshot trace buffer would
  capture those events when the trigger event occurred:

  # echo 'snapshot if nr_rq > 1' > \
        /sys/kernel/debug/tracing/events/block/block_unplug/trigger

  To only snapshot once:

  # echo 'snapshot:1 if nr_rq > 1' > \
        /sys/kernel/debug/tracing/events/block/block_unplug/trigger

  To remove the above commands:

  # echo '!snapshot if nr_rq > 1' > \
        /sys/kernel/debug/tracing/events/block/block_unplug/trigger

  # echo '!snapshot:1 if nr_rq > 1' > \
        /sys/kernel/debug/tracing/events/block/block_unplug/trigger

  Note that there can be only one snapshot trigger per triggering
  event.

不幸的是,文档没有说明保存快照的位置。

快照文件存储在哪里?

1 个答案:

答案 0 :(得分:0)

我对Linux跟踪一无所知,但我对你的问题感到好奇并阅读了文档。

ftrace.txt中,它表示它是使用tracefs公开的,但为了与旧系统兼容,它也位于debugfs

因此,如果您在debugfs处安装/sys/kernel/debug,则可以在/sys/kernel/debug/tracing/snapshot找到快照。

如果您tracefs安装了/sys/kernel/tracing,那么/sys/kernel/tracing/snapshot也安装了<{1}}。

请注意,全局snapshotper_cpu/cpu*/snapshot