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

From: Namhyung Kim
Date: Thu Apr 25 2013 - 02:50:53 EST


On Wed, 24 Apr 2013 16:17:24 +0200, Jiri Olsa wrote:
> On Tue, Apr 23, 2013 at 05:31:10PM +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@xxxxxxx>
>>
>> It's convenient to use pager when seeing many lines of result.
>>
> for some reason I'm able to get any output for 'live' command only
> when using --no-pager option. I dont get any data for:
>
> # ./perf ftrace live ls
>
> not even ls output
>
> But sometime I dont even get ftrace output for:
>
> # ./perf --no-pager ftrace live ls
>
> just ls output
>
>
> I wonder there's some race with reading trace_pipe file,
> I haven't checked deeply yet..

It seems go_pipe in perf_evlist__prepare_workload() was closed due to
the pager process, so the workload ended up blocking indefinitely.

I guess other subcommands were not affected by this since record doesn't
use a pager, and show and report don't have a workload.

Does the patch below fix it?



diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 95f9a7fa3e04..3f3a684193e0 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -1486,12 +1486,12 @@ __cmd_ftrace_live(struct perf_ftrace *ftrace, int argc, const char **argv)
if (!argc && perf_target__none(&ftrace->target))
usage_with_options(live_usage, live_options);

+ setup_pager();
+
ret = ftrace_setup(ftrace, argc, argv);
if (ret < 0)
return ret;

- setup_pager();
-
ret = do_ftrace_live(ftrace);

ftrace_teardown(ftrace);
--
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/