rdiff-backup-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Rdiff-backup-commits] rdiff-backup CHANGELOG rdiff_backup/Main.py rdi..


From: Andrew Ferguson
Subject: [Rdiff-backup-commits] rdiff-backup CHANGELOG rdiff_backup/Main.py rdi...
Date: Sat, 03 Jan 2009 21:36:00 +0000

CVSROOT:        /sources/rdiff-backup
Module name:    rdiff-backup
Changes by:     Andrew Ferguson <owsla> 09/01/03 21:35:59

Modified files:
        .              : CHANGELOG 
        rdiff_backup   : Main.py Security.py backup.py statistics.py 

Log message:
        Take start and end times from same system so that the elapsed time 
printed in
        the statistics is not affected by time zone.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/CHANGELOG?cvsroot=rdiff-backup&r1=1.341&r2=1.342
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/Main.py?cvsroot=rdiff-backup&r1=1.130&r2=1.131
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/Security.py?cvsroot=rdiff-backup&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/backup.py?cvsroot=rdiff-backup&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/statistics.py?cvsroot=rdiff-backup&r1=1.22&r2=1.23

Patches:
Index: CHANGELOG
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/CHANGELOG,v
retrieving revision 1.341
retrieving revision 1.342
diff -u -b -r1.341 -r1.342
--- CHANGELOG   3 Jan 2009 21:32:40 -0000       1.341
+++ CHANGELOG   3 Jan 2009 21:35:59 -0000       1.342
@@ -1,6 +1,9 @@
 New in v1.3.0 (????/??/??)
 ---------------------------
 
+Take start and end times from same system so that the elapsed time printed in
+the statistics is not affected by time zone. (Andrew Ferguson)
+
 Properly fix escaping DOS devices and trailing periods and spaces; now supports
 native Windows and Linxu/FAT32. (Andrew Ferguson)
 

Index: rdiff_backup/Main.py
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/Main.py,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -b -r1.130 -r1.131
--- rdiff_backup/Main.py        3 Jan 2009 21:32:40 -0000       1.130
+++ rdiff_backup/Main.py        3 Jan 2009 21:35:59 -0000       1.131
@@ -20,7 +20,7 @@
 """Start (and end) here - read arguments, set global settings, etc."""
 
 from __future__ import generators
-import getopt, sys, re, os, cStringIO, tempfile
+import getopt, sys, re, os, cStringIO, tempfile, time
 from log import Log, LoggerError, ErrorLog
 import Globals, Time, SetConnections, selection, robust, rpath, \
           manage, backup, connection, restore, FilenameMapping, \
@@ -345,6 +345,7 @@
        else:
                backup.Mirror(rpin, rpout)
                rpout.conn.Main.backup_touch_curmirror_local(rpin, rpout)
+       rpout.conn.Main.backup_close_statistics(time.time())
 
 def backup_quoted_rpaths(rpout):
        """Get QuotedRPath versions of important RPaths.  Return rpout"""
@@ -534,6 +535,19 @@
        C.sync() # Make sure everything is written before curmirror is removed
        older_inc.delete()
 
+def backup_close_statistics(end_time):
+       """Close out the tracking of the backup statistics.
+       
+       Moved to run at this point so that only the clock of the system on which
+       rdiff-backup is run is used (set by passing in time.time() from that
+       system). Use at end of session.
+
+       """
+       assert Globals.rbdir.conn is Globals.local_connection
+       if Globals.print_statistics: statistics.print_active_stats(end_time)
+       if Globals.file_statistics: statistics.FileStats.close()
+       statistics.write_active_statfileobj(end_time)
+
 
 def Restore(src_rp, dest_rp, restore_as_of = None):
        """Main restoring function

Index: rdiff_backup/Security.py
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/Security.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- rdiff_backup/Security.py    12 Oct 2008 02:21:30 -0000      1.37
+++ rdiff_backup/Security.py    3 Jan 2009 21:35:59 -0000       1.38
@@ -173,6 +173,7 @@
                                  
"backup.DestinationStruct.patch_and_increment",
                                  "Main.backup_touch_curmirror_local",
                                  "Main.backup_remove_curmirror_local",
+                                 "Main.backup_close_statistics",
                                  "regress.check_pids",
                                  "Globals.ITRB.increment_stat",
                                  "statistics.record_error",

Index: rdiff_backup/backup.py
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/backup.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- rdiff_backup/backup.py      20 Dec 2008 14:27:12 -0000      1.46
+++ rdiff_backup/backup.py      3 Jan 2009 21:35:59 -0000       1.47
@@ -490,10 +490,6 @@
                self.metawriter.close()
                metadata.ManagerObj.ConvertMetaToDiff()
 
-               if Globals.print_statistics: statistics.print_active_stats()
-               if Globals.file_statistics: statistics.FileStats.close()
-               statistics.write_active_statfileobj()
-
 
 class PatchITRB(rorpiter.ITRBranch):
        """Patch an rpath with the given diff iters (use with IterTreeReducer)

Index: rdiff_backup/statistics.py
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/statistics.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- rdiff_backup/statistics.py  22 Apr 2005 16:12:57 -0000      1.22
+++ rdiff_backup/statistics.py  3 Jan 2009 21:35:59 -0000       1.23
@@ -333,21 +333,21 @@
        """Add statistics of increment rp incrp if there is active statfile"""
        if _active_statfileobj: _active_statfileobj.add_increment(inc_rorp)
 
-def write_active_statfileobj():
+def write_active_statfileobj(end_time = None):
        """Write active StatFileObj object to session statistics file"""
        global _active_statfileobj
        assert _active_statfileobj
        rp_base = Globals.rbdir.append("session_statistics")
        session_stats_rp = increment.get_inc(rp_base, 'data', Time.curtime)
-       _active_statfileobj.finish()
+       _active_statfileobj.finish(end_time)
        _active_statfileobj.write_stats_to_rp(session_stats_rp)
        _active_statfileobj = None
 
-def print_active_stats():
+def print_active_stats(end_time = None):
        """Print statistics of active statobj to stdout and log"""
        global _active_statfileobj
        assert _active_statfileobj
-       _active_statfileobj.finish()
+       _active_statfileobj.finish(end_time)
        statmsg = _active_statfileobj.get_stats_logstring("Session statistics")
        log.Log.log_to_file(statmsg)
        Globals.client_conn.sys.stdout.write(statmsg)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]