aboutsummaryrefslogtreecommitdiff
path: root/mem_tests/total_mem_actual.py
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2017-02-08 10:44:04 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-02-08 10:44:04 +0000
commit271389dd3199539c4474c351942f4d4fa975b81b (patch)
tree87b3a32b13c392939d66fa93105896f5df0736a6 /mem_tests/total_mem_actual.py
parentbaba90fd78c18585d22430dc95c748f96ad0c772 (diff)
parentc5804ce784c39d6cf4f69139ab3197d989181cf9 (diff)
downloadtoolchain-utils-271389dd3199539c4474c351942f4d4fa975b81b.tar.gz
Merge remote-tracking branch 'aosp/mirror-chromium-master' into initial_import am: 870a8df6fc am: 9c6fa5f9e5
am: c5804ce784 Change-Id: I5ff109272784db60dfef5145242a68779f7f0ccb
Diffstat (limited to 'mem_tests/total_mem_actual.py')
-rwxr-xr-xmem_tests/total_mem_actual.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/mem_tests/total_mem_actual.py b/mem_tests/total_mem_actual.py
new file mode 100755
index 00000000..2d53bebe
--- /dev/null
+++ b/mem_tests/total_mem_actual.py
@@ -0,0 +1,37 @@
+#! /usr/bin/python
+"""Parses the actual memory usage from TCMalloc.
+
+This goes through logs that have the actual allocated memory (not sampled) in
+the logs. The output is of the form of:
+
+time (in seconds from some base time), amount of memory allocated by the
+application
+
+"""
+
+import argparse
+from cros_utils import compute_total_diff
+from datetime import datetime
+
+pretty_print = True
+
+parser = argparse.ArgumentParser()
+parser.add_argument('filename')
+args = parser.parse_args()
+
+my_file = open(args.filename)
+output_file = open('raw_memory_data.csv', 'a')
+
+base_time = datetime(2014, 6, 11, 0, 0)
+prev_line = ''
+half_entry = (None, None)
+
+for line in my_file:
+ if 'Output Heap Stats:' in line:
+ total_diff = compute_total_diff(line, base_time)
+ half_entry = (total_diff, None)
+ if 'Bytes in use by application' in line:
+ total_diff = half_entry[0]
+ memory_used = int(line.strip().split()[1])
+ half_entry = (None, None)
+ output_file.write('{0},{1}\n'.format(total_diff, memory_used))