From ad95b439e7b48ef459f68fbec34ac7c4b459ef2e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 13 Mar 2016 17:17:56 +0200 Subject: Report VmRSS values for Obnam --- obbenchlib/benchmarker.py | 13 ++++++++++++- obbenchlib/htmlgen.py | 4 ++++ obbenchlib/templates/benchmark.j2 | 8 ++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'obbenchlib') diff --git a/obbenchlib/benchmarker.py b/obbenchlib/benchmarker.py index 05a811c..971d8aa 100644 --- a/obbenchlib/benchmarker.py +++ b/obbenchlib/benchmarker.py @@ -168,7 +168,10 @@ class Benchmarker(object): result.set_value(obnam_subcommand, 'profile', self.read_profile()) result.set_value( obnam_subcommand, 'profile-text', self.read_profile_text()) - result.set_value(obnam_subcommand, 'log', self.read_log_file()) + + log = self.read_log_file() + result.set_value(obnam_subcommand, 'log', log) + result.set_value(obnam_subcommand, 'vmrss', self.find_max_vmrss(log)) def run_obnam_backup(self): self.run_obnam(['backup']) @@ -195,6 +198,14 @@ class Benchmarker(object): with open(self._logfile) as f: return f.read() + def find_max_vmrss(self, log_text): + vmrss = 0 + for line in log_text.splitlines(): + words = line.split() + if len(words) == 6 and words[2:4] == ['DEBUG', 'VmRSS:']: + vmrss = max(vmrss, int(words[4])) + return vmrss * 1024 + def read_profile_text(self): f = StringIO.StringIO() filename = os.path.join(self._srcdir, self.profile_name) diff --git a/obbenchlib/htmlgen.py b/obbenchlib/htmlgen.py index d5b3d2b..5a67cfc 100644 --- a/obbenchlib/htmlgen.py +++ b/obbenchlib/htmlgen.py @@ -196,17 +196,21 @@ class BenchmarkPage(HtmlPage): 'commit_date': result['commit_date'], 'commit_id': result['commit_id'], 'total': 0, + 'vmrss_max': 0, 'steps': [], } for i, step in enumerate(result['steps']): for step_name in step_names: if step_name in step: + vmrss = step[step_name].get('vmrss', 0) / 1024 / 1024 row['steps'].append({ 'filename_txt': '{}_{}.txt'.format( result['result_id'], i), 'duration': step[step_name]['duration'], + 'vmrss': vmrss, }) row['total'] += row['steps'][-1]['duration'] + row['vmrss_max'] = max(row['vmrss_max'], vmrss) break return row diff --git a/obbenchlib/templates/benchmark.j2 b/obbenchlib/templates/benchmark.j2 index de5c10a..7666416 100644 --- a/obbenchlib/templates/benchmark.j2 +++ b/obbenchlib/templates/benchmark.j2 @@ -15,9 +15,11 @@ date commit {% for step_name in step_names %} - {{ step_name }} + {{ step_name }}
time +  
VmRSS {% endfor %} - total + total
time +  
VmRSS {% for row in table_rows %} @@ -29,8 +31,10 @@ {{ '%.1f'|format(step.duration) }} + {{ step.vmrss }} {% endfor %} {{ '%.1f'|format(row.total) }} + {{ '%d'|format(row.vmrss_max) }} {% endfor %} -- cgit v1.2.1