From ce14d9db6ba93f820b9b1ff7df733bd57420f510 Mon Sep 17 00:00:00 2001 From: bescoto Date: Thu, 22 Dec 2005 21:11:52 +0000 Subject: uses less memory, can merge multiple increments git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@717 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff-backup-statistics | 528 +++++++++++++++++++++++++---------- 1 file changed, 375 insertions(+), 153 deletions(-) diff --git a/rdiff-backup/rdiff-backup-statistics b/rdiff-backup/rdiff-backup-statistics index 761b0c3..b289fe7 100755 --- a/rdiff-backup/rdiff-backup-statistics +++ b/rdiff-backup/rdiff-backup-statistics @@ -20,65 +20,292 @@ # USA -import os, sys, re -import rdiff_backup.connection, rdiff_backup.regress -import rdiff_backup.rpath as rpath -import rdiff_backup.Globals as Globals -import rdiff_backup.restore as restore - - -tag = None # Set to an rdiff-backup session time - -def check_args(): - global tag - def error(msg): - sys.stderr.write("Command line error: %s\n" % (msg,)) - sys.exit(2) - if not (2 <= len(sys.argv) <= 3): - error("usage: %s mirror-directory [date_tag]" % (sys.argv[0],)) +import profile, pstats +import os, sys, re, getopt +from rdiff_backup import connection, regress, rpath, Globals, restore, Time, lazy + + +begin_time = None # Parse statistics at or after this time... +end_time = None # ... and at or before this time (epoch seconds) +min_ratio = .05 # report only files/directories over this number + +def parse_args(): + global begin_time, end_time, min_ratio + try: optlist, args = getopt.getopt(sys.argv[1:], "", + ["begin-time=", "end-time=", "minimum-ratio="]) + except getopt.error, e: + sys.exit("Bad commandline options: " + str(e)) + + for opt, arg in optlist: + if opt == "--begin-time": begin_time = Time.genstrtotime(arg) + elif opt == "--end-time": end_time = Time.genstrtotime(arg) + elif opt == "--minimum-ratio": min_ratio = float(arg) + else: assert 0 + + if len(args) != 1: + sys.exit("Usage: %s --begin-time