Linux事件存储快照在哪里?

问题描述:

我正在尝试收集基于kernel documentation的事件快照。Linux事件存储快照在哪里?

- 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. 

不幸的是,该文档没有提供关于快照保存位置的信息。

快照文件存储在哪里?

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

ftrace.txt,它表示它使用tracefs曝光,但为了与旧系统兼容,它也在debugfs

所以如果你有debugfs安装在/sys/kernel/debug,你可以在/sys/kernel/debug/tracing/snapshot找到快照。

如果您有tracefs安装在/sys/kernel/tracing然后也在/sys/kernel/tracing/snapshot

请注意,有全球snapshotper_cpu/cpu*/snapshot