summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-13 17:17:56 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-13 17:17:56 +0200
commitad95b439e7b48ef459f68fbec34ac7c4b459ef2e (patch)
tree2effc095806dec1c0f3586f23b103d4a5f70f9bf
parent30847030b02ad8d3323c1bd999d04728b8679ada (diff)
downloadobnam-benchmarks-ad95b439e7b48ef459f68fbec34ac7c4b459ef2e.tar.gz
Report VmRSS values for Obnam
-rw-r--r--NEWS2
-rw-r--r--obbenchlib/benchmarker.py13
-rw-r--r--obbenchlib/htmlgen.py4
-rw-r--r--obbenchlib/templates/benchmark.j28
4 files changed, 24 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 02bca2a..55733c6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Version 0.12+git, not yet released
* `obbench` now records and publishes the Obnam log file for each
benchmark step.
+* `obbench` now measures Obnam memory usage, from the VmRSS reports in
+ the Obnam log file.
Version 0.12, released 2016-03-08
----------------------------------
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 @@
<th>date</th>
<th>commit</th>
{% for step_name in step_names %}
- <th>{{ step_name }}</th>
+ <th>{{ step_name }}<br>time</th>
+ <th>&nbsp;<br>VmRSS</th>
{% endfor %}
- <th>total</th>
+ <th>total<br>time</th>
+ <th>&nbsp;<br>VmRSS</th>
</tr>
{% for row in table_rows %}
<tr>
@@ -29,8 +31,10 @@
{{ '%.1f'|format(step.duration) }}
</a>
</td>
+ <td>{{ step.vmrss }}</td>
{% endfor %}
<td>{{ '%.1f'|format(row.total) }}</td>
+ <td>{{ '%d'|format(row.vmrss_max) }}</td>
</tr>
{% endfor %}
</table>