summaryrefslogtreecommitdiff
path: root/obbench
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-07-16 16:16:19 +0300
committerLars Wirzenius <liw@liw.fi>2015-07-16 16:16:19 +0300
commit818f5cf87329edcd6dc0dd9ebecb199b700eade1 (patch)
tree7da8c5b21e68f078c829e76c1c4c9991d37e34d2 /obbench
parent07457423dd8df274dd6e03aa17fd52fefe3a1bc6 (diff)
downloadobnam-benchmarks-818f5cf87329edcd6dc0dd9ebecb199b700eade1.tar.gz
Gather profile output from obnam runs
Diffstat (limited to 'obbench')
-rwxr-xr-xobbench33
1 files changed, 24 insertions, 9 deletions
diff --git a/obbench b/obbench
index aef629a..05571a7 100755
--- a/obbench
+++ b/obbench
@@ -122,26 +122,32 @@ class ObnamBenchmarker(cliapp.Application):
'restore': self.run_restore,
}
started = time.time()
- funcs[action](tempdir, checkout, config)
+ funcs[action](tempdir, checkout, config, step_info)
ended = time.time()
step_info['duration'] = ended - started
result.add_step(step_info)
- def run_backup(self, tempdir, checkout, config):
- self.run_obnam(checkout, ['backup', '--config', config])
+ def run_backup(self, tempdir, checkout, config, step_info):
+ self.run_obnam(step_info, checkout, ['backup', '--config', config])
- def run_restore(self, tempdir, checkout, config):
+ def run_restore(self, tempdir, checkout, config, step_info):
restored = os.path.join(tempdir, 'restored')
if os.path.exists(restored):
shutil.rmtree(restored)
self.run_obnam(
- checkout,
+ step_info, checkout,
['restore', '--config', config, '--to', restored])
- def run_obnam(self, checkout, args):
+ def run_obnam(self, step_info, checkout, args):
+ env = dict(os.environ)
+ env['OBNAM_PROFILE'] = 'obnam.prof'
cliapp.runcmd(
['./obnam', '--no-default-config'] + args,
+ env=env,
+ cwd=checkout)
+ step_info['profile'] = cliapp.runcmd(
+ ['./obnam-viewprof', 'obnam.prof'],
cwd=checkout)
def save_result(self, spec, benchmark, result):
@@ -202,15 +208,24 @@ class ObnamBenchmarker(cliapp.Application):
f.write('</tr>\n')
f.write('<tr>\n')
- for step in steps:
+ for index, step in enumerate(steps):
+ basename = '{commit}_{name}_{index}.txt'.format(
+ commit=obj['commit_id'],
+ name=obj['name'],
+ index=index)
+
+ profile_filename = os.path.join(spec['html_dir'], basename)
+ with open(profile_filename, 'w') as profile:
+ profile.write(step['profile'])
+
f.write(
- '<td>{duration}</td>\n'.format(
+ '<td><a href="{link}">{duration}</a></td>\n'.format(
+ link=self.q(basename),
duration=self.q('%.1f' % step['duration'])))
f.write('</tr>\n')
f.write('</table>\n')
f.write('</body>\n')
-
f.write('</html>\n')
def q(self, text):