Re: [PATCH 12/14] perf ftrace: Use pager for displaying result

From: Jiri Olsa
Date: Fri May 10 2013 - 05:04:29 EST


On Wed, May 08, 2013 at 02:49:10PM +0900, Namhyung Kim wrote:

SNIP

>
>
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index f1ecfa207822..6b7aeae2dfa5 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -40,9 +40,11 @@ struct perf_ftrace {
> };
>
> static bool done;
> +static int _signal;
>
> static void sig_handler(int sig __maybe_unused)
> {
> + _signal = sig;
> done = true;
> }
>
> @@ -218,6 +220,20 @@ static int do_ftrace_live(struct perf_ftrace *ftrace)
>
> perf_evlist__start_workload(ftrace->evlist);
>
> + BUG_ON(ftrace->evlist->threads->map[0] != ftrace->evlist->workload.pid);
> +
> + trace_file = get_tracing_file("tracing_on");
> + if (trace_file) {
> + int fd = open(trace_file, O_RDONLY);
> +
> + BUG_ON(fd < 0);
> + BUG_ON(read(fd, buf, sizeof(buf)) < 0);
> + BUG_ON(buf[0] != '1');
> +
> + close(fd);
> + put_tracing_file(trace_file);
> + }
> +
> while (!done) {
> if (poll(&pollfd, 1, -1) < 0)
> break;
> @@ -231,6 +247,7 @@ static int do_ftrace_live(struct perf_ftrace *ftrace)
> }
> }
>
> + psignal(_signal, "perf");
> write_tracing_file("tracing_on", "0");
>
> /* read remaining buffer contents */
>
>

yep, that did it.. seems I'm getting the ftrace output
all the time, with:

[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
perf: Child exited
[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
1) 0.030 us | perf: Child exited
[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
1) perf: Child exited
[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
2) perf: Child exited
[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
1) 4.549 us perf: Child exited
^[[A[jolsa@krava perf]$ sudo ./perf --no-pager ftrace live ls -l /usr/ 2>&1 | grep perf
1) 0.024 us | perf: Child exited


thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/