From 56070ea4b5efb32b54aaecd83ff2881560eb99a8 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 13 Jan 2006 15:28:01 +0100 Subject: [PATCH] [PATCH] blktrace: add warning about increasing buffer size with dropped events --- blktrace.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/blktrace.c b/blktrace.c index 3edfc67..882c403 100644 --- a/blktrace.c +++ b/blktrace.c @@ -683,26 +683,34 @@ static int get_dropped_count(const char *buts_name) static void show_stats(void) { - int i, j, dropped; + int i, j, dropped, total_drops, no_stdout = 0; struct device_information *dip; struct thread_information *tip; unsigned long long events_processed; if (output_name && !strcmp(output_name, "-")) - return; + no_stdout = 1; + total_drops = 0; for_each_dip(dip, i) { - printf("Device: %s\n", dip->path); + if (!no_stdout) + printf("Device: %s\n", dip->path); events_processed = 0; for_each_tip(dip, tip, j) { - printf(" CPU%3d: %20ld events\n", - tip->cpu, tip->events_processed); + if (!no_stdout) + printf(" CPU%3d: %20ld events\n", + tip->cpu, tip->events_processed); events_processed += tip->events_processed; } dropped = get_dropped_count(dip->buts_name); - printf(" Total: %20lld events (dropped %d)\n", - events_processed, dropped); + total_drops += dropped; + if (!no_stdout) + printf(" Total: %20lld events (dropped %d)\n", + events_processed, dropped); } + + if (total_drops) + fprintf(stderr, "You have dropped events, consider using a larger buffer size (-b)\n"); } static char usage_str[] = \ -- 2.25.1