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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 submatched = self._OLD_HOOKED_PATTERN.match(matched.group(8)) | 1029 submatched = self._OLD_HOOKED_PATTERN.match(matched.group(8)) |
1030 elif matched.group(7) == 'unhooked': | 1030 elif matched.group(7) == 'unhooked': |
1031 submatched = self._UNHOOKED_PATTERN.match(matched.group(8)) | 1031 submatched = self._UNHOOKED_PATTERN.match(matched.group(8)) |
1032 if not submatched: | 1032 if not submatched: |
1033 submatched = self._OLD_UNHOOKED_PATTERN.match(matched.group(8)) | 1033 submatched = self._OLD_UNHOOKED_PATTERN.match(matched.group(8)) |
1034 else: | 1034 else: |
1035 assert matched.group(7) in ['hooked', 'unhooked'] | 1035 assert matched.group(7) in ['hooked', 'unhooked'] |
1036 | 1036 |
1037 submatched_dict = submatched.groupdict() | 1037 submatched_dict = submatched.groupdict() |
1038 region_info = { 'vma': current_vma } | 1038 region_info = { 'vma': current_vma } |
1039 if 'TYPE' in submatched_dict: | 1039 if submatched_dict.get('TYPE'): |
1040 region_info['type'] = submatched_dict['TYPE'].strip() | 1040 region_info['type'] = submatched_dict['TYPE'].strip() |
1041 if 'COMMITTED' in submatched_dict: | 1041 if submatched_dict.get('COMMITTED'): |
1042 region_info['committed'] = int(submatched_dict['COMMITTED']) | 1042 region_info['committed'] = int(submatched_dict['COMMITTED']) |
1043 if 'RESERVED' in submatched_dict: | 1043 if submatched_dict.get('RESERVED'): |
1044 region_info['reserved'] = int(submatched_dict['RESERVED']) | 1044 region_info['reserved'] = int(submatched_dict['RESERVED']) |
1045 if 'BUCKETID' in submatched_dict: | 1045 if submatched_dict.get('BUCKETID'): |
1046 region_info['bucket_id'] = int(submatched_dict['BUCKETID']) | 1046 region_info['bucket_id'] = int(submatched_dict['BUCKETID']) |
1047 | 1047 |
1048 self._map[(int(matched.group(2), 16), | 1048 self._map[(int(matched.group(2), 16), |
1049 int(matched.group(5), 16))] = (matched.group(7), region_info) | 1049 int(matched.group(5), 16))] = (matched.group(7), region_info) |
1050 ln += 1 | 1050 ln += 1 |
1051 | 1051 |
1052 def _extract_stacktrace_lines(self, line_number): | 1052 def _extract_stacktrace_lines(self, line_number): |
1053 """Extracts the position of stacktrace lines. | 1053 """Extracts the position of stacktrace lines. |
1054 | 1054 |
1055 Valid stacktrace lines are stored into self._stacktrace_lines. | 1055 Valid stacktrace lines are stored into self._stacktrace_lines. |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 errorcode = COMMANDS[action]().do(sys.argv) | 1894 errorcode = COMMANDS[action]().do(sys.argv) |
1895 except ParsingException, e: | 1895 except ParsingException, e: |
1896 errorcode = 1 | 1896 errorcode = 1 |
1897 sys.stderr.write('Exit by parsing error: %s\n' % e) | 1897 sys.stderr.write('Exit by parsing error: %s\n' % e) |
1898 | 1898 |
1899 return errorcode | 1899 return errorcode |
1900 | 1900 |
1901 | 1901 |
1902 if __name__ == '__main__': | 1902 if __name__ == '__main__': |
1903 sys.exit(main()) | 1903 sys.exit(main()) |
OLD | NEW |