From e669adf83d2d2e4fe7b3f230a0de88e3195f6a47 Mon Sep 17 00:00:00 2001 From: theodegeest Date: Mon, 15 Dec 2025 20:36:17 +0100 Subject: [PATCH] flush stdout once attached to process Signed-off-by: theodegeest --- libbpf-tools/offcputime.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libbpf-tools/offcputime.c b/libbpf-tools/offcputime.c index 776468b6a666..4b8cd3a0abf0 100644 --- a/libbpf-tools/offcputime.c +++ b/libbpf-tools/offcputime.c @@ -319,10 +319,10 @@ static void print_headers() if (!print_header_threads()) printf(" all threads"); - if (env.duration < 99999999) - printf(" for %d secs.\n", env.duration); - else - printf("... Hit Ctrl-C to end.\n"); + if (env.duration < 99999999) printf(" for %d secs.\n", env.duration); + else printf("... Hit Ctrl-C to end.\n"); + + fflush(stdout); } int main(int argc, char **argv)