diff options
author | Luis Lozano <llozano@chromium.org> | 2015-12-15 13:49:30 -0800 |
---|---|---|
committer | Luis Lozano <llozano@chromium.org> | 2015-12-16 17:36:06 +0000 |
commit | f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch) | |
tree | 185d243c7eed7c7a0db6f0e640746cadc1479ea9 /mem_tests/mem_groups.py | |
parent | 2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff) | |
download | toolchain-utils-f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe.tar.gz |
Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues.
Ran by doing this:
for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i
--remove_trailing_comma --yapf --force_quote_type=double $f ; else
pyformat -i --remove_shebang --remove_trailing_comma --yapf
--force_quote_type=double $f ; fi ; done
BUG=chromium:567921
TEST=Ran simple crosperf run.
Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1
Reviewed-on: https://chrome-internal-review.googlesource.com/242031
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'mem_tests/mem_groups.py')
-rwxr-xr-x | mem_tests/mem_groups.py | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/mem_tests/mem_groups.py b/mem_tests/mem_groups.py index 75591182..6de76914 100755 --- a/mem_tests/mem_groups.py +++ b/mem_tests/mem_groups.py @@ -1,5 +1,4 @@ #! /usr/bin/python - """Groups memory by allocation sizes. Takes a log entry and sorts sorts everything into groups based on what size @@ -20,37 +19,37 @@ from datetime import datetime pretty_print = True parser = argparse.ArgumentParser() -parser.add_argument("filename") +parser.add_argument('filename') args = parser.parse_args() my_file = open(args.filename) -output_file = open("groups.csv", "a") +output_file = open('groups.csv', 'a') # The cutoffs for each group in the output (in bytes) groups = [1024, 8192, 65536, 524288, 4194304] base_time = datetime(2014, 6, 11, 0, 0) -prev_line = "" +prev_line = '' half_entry = (None, None) for line in my_file: - if "heap profile:" in line: - if half_entry[0] is not None: - group_totals = half_entry[1] - total = sum(group_totals) * 1.0 - to_join = [half_entry[0]] + [value / total for value in group_totals] - to_output = ",".join([str(elem) for elem in to_join]) - output_file.write(to_output) - total_diff = compute_total_diff(line, base_time) - half_entry = (total_diff, [0]*(len(groups) + 1)) - if "] @ " in line and "heap profile:" not in line: - mem_samples = line.strip().split("[")[0] - num_samples, total_mem = map(int, mem_samples.strip().split(":")) - mem_per_sample = total_mem // num_samples - group_totals = half_entry[1] - for cutoff_index in range(len(groups)): - if mem_per_sample <= groups[cutoff_index]: - group_totals[cutoff_index] += total_mem - break - if mem_per_sample > groups[-1]: - group_totals[-1] += total_mem + if 'heap profile:' in line: + if half_entry[0] is not None: + group_totals = half_entry[1] + total = sum(group_totals) * 1.0 + to_join = [half_entry[0]] + [value / total for value in group_totals] + to_output = ','.join([str(elem) for elem in to_join]) + output_file.write(to_output) + total_diff = compute_total_diff(line, base_time) + half_entry = (total_diff, [0] * (len(groups) + 1)) + if '] @ ' in line and 'heap profile:' not in line: + mem_samples = line.strip().split('[')[0] + num_samples, total_mem = map(int, mem_samples.strip().split(':')) + mem_per_sample = total_mem // num_samples + group_totals = half_entry[1] + for cutoff_index in range(len(groups)): + if mem_per_sample <= groups[cutoff_index]: + group_totals[cutoff_index] += total_mem + break + if mem_per_sample > groups[-1]: + group_totals[-1] += total_mem |