Skip to content
Advertisement

How to print full trace file of trace_printk in ftrace?

I am using trace_printk() to print some numbers (they are around a million number). However when I check /sys/kernel/debug/tracing/trace … only a part of the full range is printed.

Can anyone suggest me how to increase the buffer size or any way to print the full range via any option.

*Note: I don’t care about the other output of ftrace.

*Note2: I am kinda beginner in using ftrace and kernel functions.

Advertisement

Answer

on Ubuntu 18.04 basis

  1. The buffer_size_kb file exists in the /sys/kernel/debug/tracing directory.

    You can make changes through echo.

    $ eche echo 4096 > buffer_size_kb
    

    The buffer_size_kb * cpu core count = buffer_total_size_kb is automatically calculated and stored.

    This will increase the amount in the ftrace file.

  2. Overwrite file exists in /sys/kernel/debug/tracing/options directory.

    Overwrite files can also be changed to echo.

    $ eche echo 4096 > buffer_size_kb
    

    The default value is 1, which throws away the oldest event (first part). Conversely, if zero, discard the most recent event (the back).

    In this case, the amount of ftrace files does not increase, and you can see the first or last.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement