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

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

Issue 12575008: Dump stats of memory pages which are hooked, but absent from /proc/<pid>/maps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 from datetime import datetime 7 from datetime import datetime
8 import json 8 import json
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 return (version, ln) 736 return (version, ln)
737 737
738 def _parse_global_stats(self): 738 def _parse_global_stats(self):
739 """Parses lines in self._lines as global stats.""" 739 """Parses lines in self._lines as global stats."""
740 (ln, _) = skip_while( 740 (ln, _) = skip_while(
741 0, len(self._lines), 741 0, len(self._lines),
742 lambda n: self._lines[n] != 'GLOBAL_STATS:\n') 742 lambda n: self._lines[n] != 'GLOBAL_STATS:\n')
743 743
744 global_stat_names = [ 744 global_stat_names = [
745 'total', 'file-exec', 'file-nonexec', 'anonymous', 'stack', 'other', 745 'total', 'absent', 'file-exec', 'file-nonexec', 'anonymous', 'stack',
746 'nonprofiled-absent', 'nonprofiled-anonymous', 746 'other', 'nonprofiled-absent', 'nonprofiled-anonymous',
747 'nonprofiled-file-exec', 'nonprofiled-file-nonexec', 747 'nonprofiled-file-exec', 'nonprofiled-file-nonexec',
748 'nonprofiled-stack', 'nonprofiled-other', 748 'nonprofiled-stack', 'nonprofiled-other',
749 'profiled-mmap', 'profiled-malloc'] 749 'profiled-mmap', 'profiled-malloc']
750 750
751 for prefix in global_stat_names: 751 for prefix in global_stat_names:
752 (ln, _) = skip_while( 752 (ln, _) = skip_while(
753 ln, len(self._lines), 753 ln, len(self._lines),
754 lambda n: self._lines[n].split()[0] != prefix) 754 lambda n: self._lines[n].split()[0] != prefix)
755 words = self._lines[ln].split() 755 words = self._lines[ln].split()
756 self._global_stats[prefix + '_virtual'] = int(words[-2]) 756 self._global_stats[prefix + '_virtual'] = int(words[-2])
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 sizes['tc-total-log']) 977 sizes['tc-total-log'])
978 sizes['tc-total-record'] = dump.global_stat('profiled-malloc_committed') 978 sizes['tc-total-record'] = dump.global_stat('profiled-malloc_committed')
979 sizes['tc-unused'] = ( 979 sizes['tc-unused'] = (
980 sizes['mmap-tcmalloc'] - 980 sizes['mmap-tcmalloc'] -
981 dump.global_stat('profiled-malloc_committed')) 981 dump.global_stat('profiled-malloc_committed'))
982 sizes['tc-total'] = sizes['mmap-tcmalloc'] 982 sizes['tc-total'] = sizes['mmap-tcmalloc']
983 983
984 for key, value in { 984 for key, value in {
985 'total': 'total_committed', 985 'total': 'total_committed',
986 'filemapped': 'file_committed', 986 'filemapped': 'file_committed',
987 'absent': 'absent_committed',
Alexander Potapenko 2013/03/13 13:03:19 I wonder if you can make this map global and use t
Dai Mikurube (NOT FULLTIME) 2013/03/14 11:26:22 Yeah, I actually would like to do it, but it actua
987 'file-exec': 'file-exec_committed', 988 'file-exec': 'file-exec_committed',
988 'file-nonexec': 'file-nonexec_committed', 989 'file-nonexec': 'file-nonexec_committed',
989 'anonymous': 'anonymous_committed', 990 'anonymous': 'anonymous_committed',
990 'stack': 'stack_committed', 991 'stack': 'stack_committed',
991 'other': 'other_committed', 992 'other': 'other_committed',
992 'unhooked-absent': 'nonprofiled-absent_committed', 993 'unhooked-absent': 'nonprofiled-absent_committed',
993 'unhooked-anonymous': 'nonprofiled-anonymous_committed', 994 'unhooked-anonymous': 'nonprofiled-anonymous_committed',
994 'unhooked-file-exec': 'nonprofiled-file-exec_committed', 995 'unhooked-file-exec': 'nonprofiled-file-exec_committed',
995 'unhooked-file-nonexec': 'nonprofiled-file-nonexec_committed', 996 'unhooked-file-nonexec': 'nonprofiled-file-nonexec_committed',
996 'unhooked-stack': 'nonprofiled-stack_committed', 997 'unhooked-stack': 'nonprofiled-stack_committed',
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 errorcode = COMMANDS[action]().do(sys.argv) 1360 errorcode = COMMANDS[action]().do(sys.argv)
1360 except ParsingException, e: 1361 except ParsingException, e:
1361 errorcode = 1 1362 errorcode = 1
1362 sys.stderr.write('Exit by parsing error: %s\n' % e) 1363 sys.stderr.write('Exit by parsing error: %s\n' % e)
1363 1364
1364 return errorcode 1365 return errorcode
1365 1366
1366 1367
1367 if __name__ == '__main__': 1368 if __name__ == '__main__':
1368 sys.exit(main()) 1369 sys.exit(main())
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/deep-heap-profile.cc ('k') | tools/deep_memory_profiler/policy.l0.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698