Skip to contentSkip to conversation

perf: ftrace: flush output after each writing

PATCH Applied Changbin Du 2 participants 2 messages May 13, 2023 – May 15, 2023 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tools/perf/builtin-ftrace.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/builtin-ftrace.c +2 -0
index 810e3376c7d6..ad2a9ae041f6 100644
@@ -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);
 		}
 	}
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw

Em Sat, May 13, 2023 at 03:40:00PM +0800, Changbin Du escreveu:

Quoted 2 lines

The pager will result stdout in full buffering mode instead of line buffering. We need to make the trace visible timely.

Thanks, applied.

- Arnaldo

Quoted 21 lines
---
 tools/perf/builtin-ftrace.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/builtin-ftrace.c +2 -0
index 810e3376c7d6..ad2a9ae041f6 100644
@@ -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);
 		}
 	}
 
Signature · 1 line
2.25.1
Signature · 1 line
- Arnaldo