Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """The deep heap profiler script for Chrome.""" | 5 """The deep heap profiler script for Chrome.""" |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 import datetime | 8 import datetime |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1655 LOGGER.info('total: %d\n' % total) | 1655 LOGGER.info('total: %d\n' % total) |
| 1656 | 1656 |
| 1657 @staticmethod | 1657 @staticmethod |
| 1658 def _accumulate(dump, policy, bucket_set, component_name, depth, sizes): | 1658 def _accumulate(dump, policy, bucket_set, component_name, depth, sizes): |
| 1659 for line in dump.iter_stacktrace: | 1659 for line in dump.iter_stacktrace: |
| 1660 words = line.split() | 1660 words = line.split() |
| 1661 bucket = bucket_set.get(int(words[BUCKET_ID])) | 1661 bucket = bucket_set.get(int(words[BUCKET_ID])) |
| 1662 component_match = policy.find(bucket) | 1662 component_match = policy.find(bucket) |
| 1663 if component_match == component_name: | 1663 if component_match == component_name: |
| 1664 stacktrace_sequence = '' | 1664 stacktrace_sequence = '' |
| 1665 stacktrace_sequence += '(alloc=%d) ' % int(words[ALLOC_COUNT]) | |
| 1666 stacktrace_sequence += '(free=%d) ' % int(words[FREE_COUNT]) | |
| 1665 if bucket.typeinfo: | 1667 if bucket.typeinfo: |
| 1666 stacktrace_sequence += '(type=%s)' % bucket.symbolized_typeinfo | 1668 stacktrace_sequence += '(type=%s)' % bucket.symbolized_typeinfo |
|
peria
2013/06/11 08:36:36
Please put a space just after ')', and remove a sp
| |
| 1667 stacktrace_sequence += ' (type.name=%s) ' % bucket.typeinfo_name | 1669 stacktrace_sequence += ' (type.name=%s) ' % bucket.typeinfo_name |
| 1668 for function, sourcefile in zip( | 1670 for function, sourcefile in zip( |
| 1669 bucket.symbolized_stackfunction[ | 1671 bucket.symbolized_stackfunction[ |
| 1670 0 : min(len(bucket.symbolized_stackfunction), 1 + depth)], | 1672 0 : min(len(bucket.symbolized_stackfunction), 1 + depth)], |
| 1671 bucket.symbolized_stacksourcefile[ | 1673 bucket.symbolized_stacksourcefile[ |
| 1672 0 : min(len(bucket.symbolized_stacksourcefile), 1 + depth)]): | 1674 0 : min(len(bucket.symbolized_stacksourcefile), 1 + depth)]): |
| 1673 stacktrace_sequence += '%s(@%s) ' % (function, sourcefile) | 1675 stacktrace_sequence += '%s(@%s) ' % (function, sourcefile) |
| 1674 if not stacktrace_sequence in sizes: | 1676 if not stacktrace_sequence in sizes: |
| 1675 sizes[stacktrace_sequence] = 0 | 1677 sizes[stacktrace_sequence] = 0 |
| 1676 sizes[stacktrace_sequence] += int(words[COMMITTED]) | 1678 sizes[stacktrace_sequence] += int(words[COMMITTED]) |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1900 errorcode = COMMANDS[action]().do(sys.argv) | 1902 errorcode = COMMANDS[action]().do(sys.argv) |
| 1901 except ParsingException, e: | 1903 except ParsingException, e: |
| 1902 errorcode = 1 | 1904 errorcode = 1 |
| 1903 sys.stderr.write('Exit by parsing error: %s\n' % e) | 1905 sys.stderr.write('Exit by parsing error: %s\n' % e) |
| 1904 | 1906 |
| 1905 return errorcode | 1907 return errorcode |
| 1906 | 1908 |
| 1907 | 1909 |
| 1908 if __name__ == '__main__': | 1910 if __name__ == '__main__': |
| 1909 sys.exit(main()) | 1911 sys.exit(main()) |
| OLD | NEW |