Output the stats and the end-of-run verbose output using the new
authorWayne Davison <wayned@samba.org>
Sat, 12 Nov 2005 19:53:26 +0000 (19:53 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 12 Nov 2005 19:53:26 +0000 (19:53 +0000)
human_num() and human_dnum() functions, which both honor the
new --human-readable option.

main.c

diff --git a/main.c b/main.c
index aa46f98..d680f15 100644 (file)
--- a/main.c
+++ b/main.c
@@ -209,14 +209,14 @@ static void output_summary(void)
                rprintf(FINFO,"\nNumber of files: %d\n", stats.num_files);
                rprintf(FINFO,"Number of files transferred: %d\n",
                        stats.num_transferred_files);
-               rprintf(FINFO,"Total file size: %.0f bytes\n",
-                       (double)stats.total_size);
-               rprintf(FINFO,"Total transferred file size: %.0f bytes\n",
-                       (double)stats.total_transferred_size);
-               rprintf(FINFO,"Literal data: %.0f bytes\n",
-                       (double)stats.literal_data);
-               rprintf(FINFO,"Matched data: %.0f bytes\n",
-                       (double)stats.matched_data);
+               rprintf(FINFO,"Total file size: %s bytes\n",
+                       human_num(stats.total_size));
+               rprintf(FINFO,"Total transferred file size: %s bytes\n",
+                       human_num(stats.total_transferred_size));
+               rprintf(FINFO,"Literal data: %s bytes\n",
+                       human_num(stats.literal_data));
+               rprintf(FINFO,"Matched data: %s bytes\n",
+                       human_num(stats.matched_data));
                rprintf(FINFO,"File list size: %d\n", stats.flist_size);
                if (stats.flist_buildtime) {
                        rprintf(FINFO,
@@ -226,19 +226,19 @@ static void output_summary(void)
                                "File list transfer time: %.3f seconds\n",
                                (double)stats.flist_xfertime / 1000);
                }
-               rprintf(FINFO,"Total bytes sent: %.0f\n",
-                       (double)total_written);
-               rprintf(FINFO,"Total bytes received: %.0f\n",
-                       (double)total_read);
+               rprintf(FINFO,"Total bytes sent: %s\n",
+                       human_num(total_written));
+               rprintf(FINFO,"Total bytes received: %s\n",
+                       human_num(total_read));
        }
 
        if (verbose || do_stats) {
                rprintf(FINFO,
-                       "\nsent %.0f bytes  received %.0f bytes  %.2f bytes/sec\n",
-                       (double)total_written, (double)total_read,
-                       (total_written + total_read)/(0.5 + (endtime - starttime)));
-               rprintf(FINFO, "total size is %.0f  speedup is %.2f\n",
-                       (double)stats.total_size,
+                       "\nsent %s bytes  received %s bytes  %s bytes/sec\n",
+                       human_num(total_written), human_num(total_read),
+                       human_dnum((total_written + total_read)/(0.5 + (endtime - starttime)), 2));
+               rprintf(FINFO, "total size is %s  speedup is %.2f\n",
+                       human_num(stats.total_size),
                        (double)stats.total_size / (total_written+total_read));
        }