summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-03 21:35:59 +0000
committerowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-03 21:35:59 +0000
commit7eba4b4cdd8530530b8708947cf7a2799f7cb55d (patch)
treeea6a763257ca75d1f91af06620ec75153df4d671
parente389196e3426dde8957d38b4da8135489f80ae6a (diff)
downloadrdiff-backup-7eba4b4cdd8530530b8708947cf7a2799f7cb55d.tar.gz
Take start and end times from same system so that the elapsed time printed in
the statistics is not affected by time zone. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@994 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG3
-rw-r--r--rdiff-backup/rdiff_backup/Main.py16
-rw-r--r--rdiff-backup/rdiff_backup/Security.py1
-rw-r--r--rdiff-backup/rdiff_backup/backup.py4
-rw-r--r--rdiff-backup/rdiff_backup/statistics.py8
5 files changed, 23 insertions, 9 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 09b5b80..ac9ad69 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -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)
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index 47246f6..7283bfb 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -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 @@ def Backup(rpin, rpout):
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 @@ def backup_remove_curmirror_local():
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
diff --git a/rdiff-backup/rdiff_backup/Security.py b/rdiff-backup/rdiff_backup/Security.py
index a259221..b1c6eba 100644
--- a/rdiff-backup/rdiff_backup/Security.py
+++ b/rdiff-backup/rdiff_backup/Security.py
@@ -173,6 +173,7 @@ def set_allowed_requests(sec_level):
"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",
diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py
index 6284a6b..d18c3c0 100644
--- a/rdiff-backup/rdiff_backup/backup.py
+++ b/rdiff-backup/rdiff_backup/backup.py
@@ -490,10 +490,6 @@ class CacheCollatedPostProcess:
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)
diff --git a/rdiff-backup/rdiff_backup/statistics.py b/rdiff-backup/rdiff_backup/statistics.py
index b16fb12..0bdd439 100644
--- a/rdiff-backup/rdiff_backup/statistics.py
+++ b/rdiff-backup/rdiff_backup/statistics.py
@@ -333,21 +333,21 @@ def process_increment(inc_rorp):
"""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)