Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Changbin Du and committed by
Arnaldo Carvalho de Melo
40bf1cb0 6d491b37

+2
+2
tools/perf/builtin-ftrace.c
··· 650 650 break; 651 651 if (fwrite(buf, n, 1, stdout) != 1) 652 652 break; 653 + /* flush output since stdout is in full buffering mode due to pager */ 654 + fflush(stdout); 653 655 } 654 656 } 655 657