summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangbin Du <changbin.du@huawei.com>2023-05-13 15:40:00 +0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-05-15 18:27:33 -0300
commit40bf1cb07ee72480dd831d7a13e42728dfad35e2 (patch)
tree9c9cbefea81e0f6ddd82de292157ac6f6350300c
parent6d491b37e70daeb963e3b589b746d99b8b4b1357 (diff)
perf ftrace: Flush output after each writing
The pager will result stdout in full buffering mode instead of line buffering. We need to make the trace visible timely. Signed-off-by: Changbin Du <changbin.du@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230513074000.733550-1-changbin.du@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-ftrace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 810e3376c7d6..ad2a9ae041f6 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -650,6 +650,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace)
break;
if (fwrite(buf, n, 1, stdout) != 1)
break;
+ /* flush output since stdout is in full buffering mode due to pager */
+ fflush(stdout);
}
}