From e3f8bdcc60e675f848d475efd5b662a857aec5a6 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 24 Jan 2012 22:13:31 -0500 Subject: [PATCH] read_intr: Make it flush to output so when pipping it works correctly. Signed-off-by: Konrad Rzeszutek Wilk --- root_image/tools/read_intr/read_intr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/root_image/tools/read_intr/read_intr.c b/root_image/tools/read_intr/read_intr.c index e698f4a..1772fdf 100644 --- a/root_image/tools/read_intr/read_intr.c +++ b/root_image/tools/read_intr/read_intr.c @@ -217,13 +217,14 @@ void get_delta(struct snapshot *b, struct snapshot *n, unsigned long tick) if (delta > p_new->max[i]) p_new->max[i] = delta; if (delta > DELTA) { - printf("%-5s %2d: %-5d %-5d %-5d %-20s %ldsec\n", + fprintf(stdout, "%-5s %2d: %-5d %-5d %-5d %-20s %ldsec\n", p_old->name, i, delta / MAX_SLEEP, p_new->avg[i] / MAX_SLEEP, p_new->max[i] / MAX_SLEEP, p_old->drivers, tick); } } + fflush(stdout); skip: p_old = q_old; p_new = q_new; @@ -242,8 +243,8 @@ int main(int argc, char *argv[]) return; cnt = MAX_CNT; - printf("-----------------------------------------------------------\n"); - printf("irq cpu: delta avg/s max/s driver time\n"); + fprintf(stdout,"-----------------------------------------------------------\n"); + fprintf(stdout,"irq cpu: delta avg/s max/s driver time\n"); before = get_snapshot(cpu_count); tick = 0; while (cnt--) { -- 2.39.5