Added in %done for btt
authorAlan D. Brunelle <alan.brunelle@hp.com>
Tue, 23 Sep 2008 12:06:41 +0000 (08:06 -0400)
committerAlan D. Brunelle <alan.brunelle@hp.com>
Tue, 23 Sep 2008 12:06:41 +0000 (08:06 -0400)
btt/globals.h
btt/mmap.c
btt/trace.c

index c4b76744172f8c45b8314fc62c52f1c86f7d7a75..fda1bdbf9fab42d14d64b0f15d847b1345cbb2b6 100644 (file)
@@ -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);
index 60d4900951a6f66eaa75674021cd50e4d3cc6b79..050d4f84765796ef1fd543d632c17a88307b4694 100644 (file)
@@ -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);
+}
index efb9996cdd78f1e9044683a612753bfea13381fa..ee5a654a133f9c5198642af375289527407f53ed 100644 (file)
@@ -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;