summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@xander>2010-12-18 00:24:54 +0200
committerLars Wirzenius <liw@xander>2010-12-18 00:24:54 +0200
commitf99478d6ba4152a2d9e61d8ce51d0a4b155f3587 (patch)
treef0526dbc09d468f57f5b78276cf2202844b0c08d
parente33cfe10e7cfb7b1f0ff5975e3c1e2428357219f (diff)
downloadobnam-f99478d6ba4152a2d9e61d8ce51d0a4b155f3587.tar.gz
Add --dump-memory-profile option, and dummy implementation.
-rw-r--r--obnamlib/app.py8
-rw-r--r--obnamlib/plugins/backup_plugin.py7
2 files changed, 10 insertions, 5 deletions
diff --git a/obnamlib/app.py b/obnamlib/app.py
index fd1da003..6022efa5 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -63,11 +63,9 @@ class App(object):
'(default: %default)')
self.config['lru-size'] = '%s' % obnamlib.DEFAULT_LRU_SIZE
- self.config.new_bytesize(['meliae-dump-after'],
- 'make a meliae memory profiling dump '
- 'after this many bytes have been backed up, '
- '0 means no dump (default: %default)')
- self.config['meliae-dump-after'] = str(0)
+ self.config.new_boolean(['dump-memory-profile'],
+ 'make memory profiling dumps '
+ 'after each checkpoint and at end?')
self.pm = obnamlib.PluginManager()
self.pm.locations = [self.plugins_dir()]
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index f25d1293..bb7f6c1d 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -76,6 +76,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.exclude_pats = [re.compile(x) for x in self.app.config['exclude']]
last_checkpoint = 0
+ self.meliae_counter = 0
interval = self.app.config['checkpoint']
if roots:
@@ -114,6 +115,8 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.store.lock_client(client_name)
self.store.start_generation()
last_checkpoint = storefs.bytes_written
+ if self.app.config['dump-meliae']:
+ self.dump_memory_profile()
self.backup_parents('.')
@@ -124,6 +127,10 @@ class BackupPlugin(obnamlib.ObnamPlugin):
storefs.close()
logging.info('Backup finished.')
+ self.dump_memory_profile()
+
+ def dump_memory_profile(self):
+ pass
def find_files(self, root):
'''Find all files and directories that need to be backed up.