Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: tools/deep_memory_profiler/dmprof.py

Issue 14823009: Add the reason in heap profiler dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased again Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/tcmalloc/chromium/src/heap-profiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 if self._lines[ln].startswith('Time:'): 937 if self._lines[ln].startswith('Time:'):
938 matched_seconds = self._TIME_PATTERN_SECONDS.match(self._lines[ln]) 938 matched_seconds = self._TIME_PATTERN_SECONDS.match(self._lines[ln])
939 matched_format = self._TIME_PATTERN_FORMAT.match(self._lines[ln]) 939 matched_format = self._TIME_PATTERN_FORMAT.match(self._lines[ln])
940 if matched_format: 940 if matched_format:
941 self._time = time.mktime(datetime.datetime.strptime( 941 self._time = time.mktime(datetime.datetime.strptime(
942 matched_format.group(1), '%Y/%m/%d %H:%M:%S').timetuple()) 942 matched_format.group(1), '%Y/%m/%d %H:%M:%S').timetuple())
943 if matched_format.group(2): 943 if matched_format.group(2):
944 self._time += float(matched_format.group(2)[1:]) / 1000.0 944 self._time += float(matched_format.group(2)[1:]) / 1000.0
945 elif matched_seconds: 945 elif matched_seconds:
946 self._time = float(matched_seconds.group(1)) 946 self._time = float(matched_seconds.group(1))
947 elif self._lines[ln].startswith('Reason:'):
948 pass # Nothing to do for 'Reason:'
947 else: 949 else:
948 break 950 break
949 ln += 1 951 ln += 1
950 952
951 def _parse_mmap_list(self): 953 def _parse_mmap_list(self):
952 """Parses lines in self._lines as a mmap list.""" 954 """Parses lines in self._lines as a mmap list."""
953 (ln, found) = skip_while( 955 (ln, found) = skip_while(
954 0, len(self._lines), 956 0, len(self._lines),
955 lambda n: self._lines[n] != 'MMAP_LIST:\n') 957 lambda n: self._lines[n] != 'MMAP_LIST:\n')
956 if not found: 958 if not found:
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 errorcode = COMMANDS[action]().do(sys.argv) 1816 errorcode = COMMANDS[action]().do(sys.argv)
1815 except ParsingException, e: 1817 except ParsingException, e:
1816 errorcode = 1 1818 errorcode = 1
1817 sys.stderr.write('Exit by parsing error: %s\n' % e) 1819 sys.stderr.write('Exit by parsing error: %s\n' % e)
1818 1820
1819 return errorcode 1821 return errorcode
1820 1822
1821 1823
1822 if __name__ == '__main__': 1824 if __name__ == '__main__':
1823 sys.exit(main()) 1825 sys.exit(main())
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698