aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorVugar Mammadli <v-m13@windowslive.com>2018-03-09 14:33:16 -0500
committerJosh Matthews <josh@joshmatthews.net>2018-03-19 09:49:09 -0400
commite6c85b97f9420a8f1aa463f4cfc37d0db07d3a67 (patch)
tree44dc3fc0c868677abc38bb3ef7f737e1ac62ca28 /etc
parentb93f153ed59fb993af306bd8c540887196021f87 (diff)
downloadservo-e6c85b97f9420a8f1aa463f4cfc37d0db07d3a67.tar.gz
servo-e6c85b97f9420a8f1aa463f4cfc37d0db07d3a67.zip
Support memory report logs with interleaved non-report output, added automated tests
Diffstat (limited to 'etc')
-rw-r--r--etc/memory_reports_over_time.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/etc/memory_reports_over_time.py b/etc/memory_reports_over_time.py
index 44a969d2d57..af3a052165a 100644
--- a/etc/memory_reports_over_time.py
+++ b/etc/memory_reports_over_time.py
@@ -28,7 +28,8 @@ def extract_memory_reports(lines):
elif line == 'End memory reports\n':
in_report = False
elif in_report:
- report_lines[-1].append(line.strip())
+ if line.startswith('|'):
+ report_lines[-1].append(line.strip())
return (report_lines, times)
@@ -72,6 +73,17 @@ def transform_report_for_test(report):
return transformed
+def test_extract_memory_reports():
+ input = ["Begin memory reports",
+ "|",
+ " 154.56 MiB -- explicit\n",
+ "| 107.88 MiB -- system-heap-unclassified\n",
+ "End memory reports\n"]
+ expected = ([['|', '| 107.88 MiB -- system-heap-unclassified']], ['reports'])
+ assert(extract_memory_reports(input) == expected)
+ return 0
+
+
def test():
input = '''|
| 23.89 MiB -- explicit
@@ -105,6 +117,7 @@ def test():
assert(sorted(transformed.keys()) == sorted(expected.keys()))
for k, v in transformed.items():
assert(v == expected[k])
+ test_extract_memory_reports()
return 0