From: Alan D. Brunelle Date: Tue, 23 Sep 2008 12:06:41 +0000 (-0400) Subject: Added in %done for btt X-Git-Tag: blktrace-1.0.0~17 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=32ff7e3b023c655c63d53b2b14e151f82bd83229;p=blktrace.git Added in %done for btt --- diff --git a/btt/globals.h b/btt/globals.h index c4b7674..fda1bdb 100644 --- a/btt/globals.h +++ b/btt/globals.h @@ -258,6 +258,7 @@ void dbg_ping(void); void setup_ifile(char *fname); void cleanup_ifile(void); int next_trace(struct blk_io_trace *t, void **pdu); +double pct_done(void); /* output.c */ int output_avgs(FILE *ofp); diff --git a/btt/mmap.c b/btt/mmap.c index 60d4900..050d4f8 100644 --- a/btt/mmap.c +++ b/btt/mmap.c @@ -138,3 +138,8 @@ int next_trace(struct blk_io_trace *t, void **pdu) return 1; } + +double pct_done(void) +{ + return 100.0 * ((double)cur / (double)total_size); +} diff --git a/btt/trace.c b/btt/trace.c index efb9996..ee5a654 100644 --- a/btt/trace.c +++ b/btt/trace.c @@ -28,7 +28,7 @@ static void __add_trace(struct io *iop) iostat_check_time(iop->t.time); if (verbose && ((now - last_vtrace) > 0)) { - printf("%10lu t\r", n_traces); + printf("%10lu t (%6.2lf%%)\r", n_traces, pct_done()); if ((n_traces % 1000000) == 0) printf("\n"); fflush(stdout); last_vtrace = now;