diff options
author | Lars Wirzenius <liw@xander> | 2010-12-18 00:48:20 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@xander> | 2010-12-18 00:48:20 +0200 |
commit | 1c6d30e6d672f7ce6fa4db176accf7007245ef80 (patch) | |
tree | fc1e4adf492d27db35971ad1343e77885523e4d9 | |
parent | 6c8bacfe91a842fd01492bf37b3f3a5bf7f6ec53 (diff) | |
download | obnam-1c6d30e6d672f7ce6fa4db176accf7007245ef80.tar.gz |
Allow user to decide type of memory dump.
-rw-r--r-- | obnamlib/app.py | 7 | ||||
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/obnamlib/app.py b/obnamlib/app.py index 6022efa5..bea64c7d 100644 --- a/obnamlib/app.py +++ b/obnamlib/app.py @@ -63,9 +63,12 @@ class App(object): '(default: %default)') self.config['lru-size'] = '%s' % obnamlib.DEFAULT_LRU_SIZE - self.config.new_boolean(['dump-memory-profile'], + self.config.new_string(['dump-memory-profile'], 'make memory profiling dumps ' - 'after each checkpoint and at end?') + 'after each checkpoint and at end? ' + 'set to none, meliae, or heapy ' + '(default: %default)') + self.config['dump-memory-profile'] = 'none' 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 69ea2351..55205e64 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -129,15 +129,15 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.dump_memory_profile() def dump_memory_profile(self): - if self.app.config['dump-memory-profile']: + kind = self.app.config['dump-memory-profile'] + if kind == 'heapy': from guppy import hpy h = hpy() logging.debug('memory profile:\n%s' % h.heap()) - + elif kind == 'meliae': from meliae import scanner filename = 'obnam-%d.meliae' % self.memory_dump_counter scanner.dump_all_objects(filename) - self.memory_dump_counter += 1 def find_files(self, root): |