summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-22 18:17:06 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-22 18:17:06 +0100
commit8edf20033744ab2486631fc38aa6d8782afecfe2 (patch)
tree55e7297cfe7c193f02bbcc7dcc61953f786c586e
parent962d02f1bf751ff3a3ee769bd358b847e9927200 (diff)
downloadobnam-8edf20033744ab2486631fc38aa6d8782afecfe2.tar.gz
Move memory profile dumping to cliapp.
Upgrade cliapp dependency accordingly.
-rw-r--r--debian/changelog8
-rw-r--r--debian/control4
-rw-r--r--obnamlib/app.py7
-rw-r--r--obnamlib/plugins/backup_plugin.py41
4 files changed, 15 insertions, 45 deletions
diff --git a/debian/changelog b/debian/changelog
index 121388ee..49781b47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+obnam (0.21-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * debian/control: Update python-cliapp versioned dependency to match
+ the version that provides dump_memory_profile.
+
+ -- Lars Wirzenius <liw@liw.fi> Mon, 22 Aug 2011 18:16:27 +0100
+
obnam (0.20.1-1) squeeze; urgency=low
* New upstream release.
diff --git a/debian/control b/debian/control
index 4a2a1c10..8c0bd81b 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 7.3.8),
python-paramiko,
python-tracing (>= 0.2),
fakeroot,
- python-cliapp (>= 0.14)
+ python-cliapp (>= 0.17)
Homepage: http://braawi.org/obnam/
X-Python-Version: >= 2.6
@@ -19,7 +19,7 @@ Package: obnam
Architecture: any
Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends},
python-larch (>= 0.21~), python-ttystatus (>= 0.8),
- python-paramiko, python-tracing (>= 0.2), python-cliapp (>= 0.14)
+ python-paramiko, python-tracing (>= 0.2), python-cliapp (>= 0.17)
Description: online and disk-based backup application
Obnam makes backups. Backups can be stored on local hard disks, or online
via the SSH SFTP protocol. The backup server, if used, does not require any
diff --git a/obnamlib/app.py b/obnamlib/app.py
index 1a6a7d13..2f65d087 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -54,13 +54,6 @@ class App(cliapp.Application):
'(default: %default)',
default=obnamlib.DEFAULT_LRU_SIZE)
- self.settings.choice(['dump-memory-profile'],
- ['simple', 'none', 'meliae', 'heapy'],
- 'make memory profiling dumps '
- 'after each checkpoint and at end? '
- 'set to none, simple, meliae, or heapy '
- '(default: %default)')
-
self.settings.string_list(['trace'],
'add to filename patters for which trace '
'debugging logging happens')
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index e7253111..4ffcfcb8 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -82,7 +82,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.repo.fs.close()
logging.info('Backup finished.')
- self.dump_memory_profile('at end of backup run')
+ self.app.dump_memory_profile('at end of backup run')
except BaseException:
logging.info('Unlocking client because of error')
self.repo.unlock_client()
@@ -105,37 +105,6 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.exclude_pats = [re.compile(x)
for x in self.app.settings['exclude']]
- def vmrss(self):
- f = open('/proc/self/status')
- rss = 0
- for line in f:
- if line.startswith('VmRSS'):
- rss = line.split()[1]
- f.close()
- return rss
-
- def dump_memory_profile(self, msg):
- kind = self.app.settings['dump-memory-profile']
- if kind == 'none':
- return
- logging.debug('dumping memory profiling data: %s' % msg)
- logging.debug('VmRSS: %s KiB' % self.vmrss())
- if kind in ['heapy', 'meliae']:
- # These are fairly expensive operations, so we only log them
- # if we're doing expensive stuff anyway.
- logging.debug('# objects: %d' % len(gc.get_objects()))
- logging.debug('# garbage: %d' % len(gc.garbage))
- if kind == 'heapy':
- from guppy import hpy
- h = hpy()
- logging.debug('memory profile:\n%s' % h.heap())
- elif kind == 'meliae':
- filename = 'obnam-%d.meliae' % self.memory_dump_counter
- logging.debug('memory profile: see %s' % filename)
- from meliae import scanner
- scanner.dump_all_objects(filename)
- self.memory_dump_counter += 1
-
def backup_roots(self, roots):
self.fs = self.app.fsf.new(roots[0])
self.fs.connect()
@@ -181,7 +150,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.repo.lock_client(client_name)
self.repo.start_generation()
last_checkpoint = self.repo.fs.bytes_written
- self.dump_memory_profile('at end of checkpoint')
+ self.app.dump_memory_profile('at end of checkpoint')
self.backup_parents('.')
@@ -296,7 +265,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
if len(chunkids) >= self.app.settings['chunkids-per-group']:
tracing.trace('adding %d chunkids to file' % len(chunkids))
self.repo.append_file_chunks(filename, chunkids)
- self.dump_memory_profile('after appending some chunkids')
+ self.app.dump_memory_profile('after appending some chunkids')
chunkids = []
self.app.hooks.call('progress-data-uploaded', len(data))
tracing.trace('closing file')
@@ -304,8 +273,8 @@ class BackupPlugin(obnamlib.ObnamPlugin):
if chunkids:
tracing.trace('adding final %d chunkids to file' % len(chunkids))
self.repo.append_file_chunks(filename, chunkids)
- self.dump_memory_profile('at end of file content backup for %s' %
- filename)
+ self.app.dump_memory_profile('at end of file content backup for %s' %
+ filename)
tracing.trace('done backing up file contents')
return summer.digest()