perf stat: Flush output after each line in interval mode
authorAndi Kleen <ak@linux.intel.com>
Sat, 3 Aug 2013 00:41:12 +0000 (17:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 7 Aug 2013 20:35:29 +0000 (17:35 -0300)
When interval mode is outputting to a pipe, each measurement should be
flushed individually, so that the reader sees it timely.

With a terminal each line is automatically flushed by stdio, but that is
disabled with non terminal output.

Simply fflush output after each time interval

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375490473-1503-5-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c

index 2e637e4c951d0f68e26844e14ce0d4bc11232770..f686d5ff594e6b93c6e6f732e7a1c97aa18c4e49 100644 (file)
@@ -416,6 +416,8 @@ static void print_interval(void)
                list_for_each_entry(counter, &evsel_list->entries, node)
                        print_counter_aggr(counter, prefix);
        }
+
+       fflush(output);
 }
 
 static void handle_initial_delay(void)