From 32ff7e3b023c655c63d53b2b14e151f82bd83229 Mon Sep 17 00:00:00 2001 From: "Alan D. Brunelle" Date: Tue, 23 Sep 2008 08:06:41 -0400 Subject: [PATCH] Added in %done for btt --- btt/globals.h | 1 + btt/mmap.c | 5 +++++ btt/trace.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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; -- 2.25.1