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

Unified Diff: tools/find_runtime_symbols/proc_maps.py

Issue 10825075: Classify memory usage by allocated type in Deep Memory Profiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/find_runtime_symbols/prepare_symbol_info.py ('k') | tools/find_runtime_symbols/static_symbols.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/find_runtime_symbols/proc_maps.py
diff --git a/tools/find_runtime_symbols/parse_proc_maps.py b/tools/find_runtime_symbols/proc_maps.py
old mode 100755
new mode 100644
similarity index 54%
rename from tools/find_runtime_symbols/parse_proc_maps.py
rename to tools/find_runtime_symbols/proc_maps.py
index 13c15681cac223c7cc245bf7a7aa19566d460080..4b082c33b37283d4455d4df8daf64e719255f9a2
--- a/tools/find_runtime_symbols/parse_proc_maps.py
+++ b/tools/find_runtime_symbols/proc_maps.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -60,45 +59,43 @@ class ProcMaps(object):
for index in self._sorted_indexes:
yield self._dictionary[index]
-
-def parse_proc_maps(f):
- table = ProcMaps()
- for line in f:
- matched = _MAPS_PATTERN.match(line)
- if matched:
- table.append(ProcMapsEntry(
- int(matched.group(1), 16), # begin
- int(matched.group(2), 16), # end
- matched.group(3), # readable
- matched.group(4), # writable
- matched.group(5), # executable
- matched.group(6), # private
- int(matched.group(7), 16), # offset
- matched.group(8), # major
- matched.group(9), # minor
- int(matched.group(10), 10), # inode
- matched.group(11) # name
- ))
-
- return table
-
-
-def main():
- if len(sys.argv) < 2:
- sys.stderr.write("""Usage:
-%s /path/to/maps
-""" % sys.argv[0])
- return 1
-
- with open(sys.argv[1], mode='r') as f:
- maps = parse_proc_maps(f)
-
- for entry in maps:
- print "%016x-%016x +%06x %s" % (
- entry.begin, entry.end, entry.offset, entry.name)
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main())
+ @staticmethod
+ def load(f):
+ table = ProcMaps()
+ for line in f:
+ matched = _MAPS_PATTERN.match(line)
+ if matched:
+ table.append(ProcMapsEntry(
+ int(matched.group(1), 16), # begin
+ int(matched.group(2), 16), # end
+ matched.group(3), # readable
+ matched.group(4), # writable
+ matched.group(5), # executable
+ matched.group(6), # private
+ int(matched.group(7), 16), # offset
+ matched.group(8), # major
+ matched.group(9), # minor
+ int(matched.group(10), 10), # inode
+ matched.group(11) # name
+ ))
+
+ return table
+
+ @staticmethod
+ def constants(entry):
+ return (entry.writable == '-' and entry.executable == '-' and re.match(
+ '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?',
+ entry.name))
+
+ @staticmethod
+ def executable(entry):
+ return (entry.executable == 'x' and re.match(
+ '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?',
+ entry.name))
+
+ @staticmethod
+ def executable_and_constants(entry):
+ return (((entry.writable == '-' and entry.executable == '-') or
+ entry.executable == 'x') and re.match(
+ '\S+(\.(so|dll|dylib|bundle)|chrome)((\.\d+)+\w*(\.\d+){0,3})?',
+ entry.name))
« no previous file with comments | « tools/find_runtime_symbols/prepare_symbol_info.py ('k') | tools/find_runtime_symbols/static_symbols.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698