More stats cleanups.
authorMartin Pool <mbp@samba.org>
Tue, 26 Mar 2002 07:02:56 +0000 (07:02 +0000)
committerMartin Pool <mbp@samba.org>
Tue, 26 Mar 2002 07:02:56 +0000 (07:02 +0000)
main.c
memstats.c
stats.c

diff --git a/main.c b/main.c
index 20c924f2556b7d8517af52cf5b81128562a2c332..a498e1a907eeac133ad896710b32ae83cfb57ecf 100644 (file)
--- a/main.c
+++ b/main.c
@@ -27,8 +27,6 @@ struct stats stats;
 
 extern int verbose;
 
-static void show_malloc_stats(void);
-
 /****************************************************************************
 wait for a process to exit, calling io_flush while waiting
 ****************************************************************************/
@@ -56,7 +54,6 @@ void wait_process(pid_t pid, int *status)
  **/
 static void report(int f)
 {
-       time_t t = time(NULL);
        extern int am_server;
        extern int am_sender;
        extern int am_daemon;
@@ -107,13 +104,11 @@ static void report(int f)
                show_mem_stats();
                show_flist_stats();
                show_file_stats();
+               show_net_stats();
+               show_time_stats();
        }
        
        if (verbose || do_stats) {
-               rprintf(FINFO,"wrote %.0f bytes  read %.0f bytes  %.2f bytes/sec\n",
-                      (double)stats.total_written,
-                      (double)stats.total_read,
-                      (stats.total_written+stats.total_read)/(0.5 + (t-starttime)));
                rprintf(FINFO,"total size is %.0f  speedup is %.2f\n",
                       (double)stats.total_size,
                       (1.0*stats.total_size)/(stats.total_written+stats.total_read));
index 96e65cfc67e02ed29d88004669eb71ba5012cba6..b709ce25f713409fbc8d50636de1f7ca68620918 100644 (file)
@@ -38,16 +38,18 @@ void show_mem_stats(void)
        extern struct stats stats;
        
        rprintf(FINFO, "Memory usage:\n"
-               "  %10ld    bytes file_list\n"
-               "    %10ld  bytes flist_size\n"  
-               "  %10ld    bytes hlink_list\n"
-               "  %10ld    bytes file_structs (and associated data)\n"
-               "  %10ld    bytes string_areas\n"
-               "  %10ld    bytes exclude_structs\n"
-               "  %10ld    bytes map_structs\n"
-               "  %10ld    bytes tags\n"
-               "  %10ld    bytes delete_list\n"
+               "  %10s\n"
+               "  %10ld    file_list\n"
+               "    %10ld  flist_size\n"  
+               "  %10ld    hlink_list\n"
+               "  %10ld    file_structs (and associated data)\n"
+               "  %10ld    string_areas\n"
+               "  %10ld    exclude_structs\n"
+               "  %10ld    map_structs\n"
+               "  %10ld    tags\n"
+               "  %10ld    delete_list\n"
                ,
+               "bytes",
                (long) stats.main_flist,
                (long) stats.flist_size,
                (long) stats.hlink_list,
diff --git a/stats.c b/stats.c
index c01d12ca73992e47be13594777afd6a7aa4b1a56..fa5481c7424977952467f27cfd2c7a622d6ce0a4 100644 (file)
--- a/stats.c
+++ b/stats.c
@@ -18,7 +18,9 @@
 
 #include "rsync.h"
 
-void show_file_stats()
+extern time_t starttime;
+
+void show_file_stats(void)
 {
        extern struct stats stats;
 
@@ -41,11 +43,23 @@ void show_file_stats()
                (double)stats.literal_data,
                (double)stats.matched_data,
                "?", "?", "?", "?");
+}
+
 
-       rprintf(FINFO, "Network statistics\n");
-       
-       rprintf(FINFO,"Total bytes written: %.0f\n", 
-               (double)stats.total_written);
-       rprintf(FINFO,"Total bytes read: %.0f\n\n", 
-               (double)stats.total_read);
-}      
+void show_net_stats(void)
+{
+       time_t t = time(NULL);
+       rprintf(FINFO, "Network statistics\n"
+               " %10s %10s %10s\n"
+               " %10.0f %10.0f %10.2f    total bytes\n"
+               ,
+               "read", "write", "bytes/s",
+               (double) stats.total_read,
+               (double) stats.total_written,
+               (stats.total_written+stats.total_read)/(0.5 + (t-starttime)));
+}
+
+
+void show_time_stats(void)
+{
+}