Re: [PATCH v2 2/2] tracing: kdb: Allow ftdump to skip all but the last few lines

From: Steven Rostedt
Date: Tue Mar 12 2019 - 23:25:35 EST


On Fri, 8 Mar 2019 11:32:05 -0800
Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:

> The 'ftdump' command in kdb is currently a bit of a last resort, at
> least if you have lots of traces turned on. It's going to print a
> whole boatload of lines out your serial port which is probably running
> at 115200. This could easily take many, many minutes.
>
> Usually you're most interested in what's at the _end_ of the ftrace
> buffer, AKA what happened most recently. That means you've got to
> wait the full time for the dump. The 'ftdump' command does attempt to
> help you a little bit by allowing you to skip a fixed number of lines.
> Unfortunately it provides no way for you to know how many lines you
> should skip.
>
> Let's do similar to python and allow you to use a negative number to
> indicate that you want to skip all lines except the last few. This
> allows you to quickly see what you want.

Why not just read how many entries are in the ring buffer and return that?

cnt = 0;
for_each_cpu(cpu, tr->tracing_cpumask)
cnt += ring_buffer_entries_cpu(tr->trace_buffer, cpu);
return cnt;

The output will print out one entry per line.

-- Steve


>
> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> ---
>