summaryrefslogtreecommitdiffstats
path: root/tools/deep_memory_profiler
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 12:44:13 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 12:44:13 +0000
commit19e3b948f41b896c4ffd68d35aa5c311e505b4b7 (patch)
tree6cd63f0cfabb4b0df890a95baa838d6d32ac560a /tools/deep_memory_profiler
parent9516bcec6d990de0bfdf10c925f4c7a54d02abeb (diff)
downloadchromium_src-19e3b948f41b896c4ffd68d35aa5c311e505b4b7.zip
chromium_src-19e3b948f41b896c4ffd68d35aa5c311e505b4b7.tar.gz
chromium_src-19e3b948f41b896c4ffd68d35aa5c311e505b4b7.tar.bz2
Read timestamp in heap profiles dumped by deep-heap-profile.cc.
BUG=231800 NOTRY=true R=peria@chromium.org Review URL: https://codereview.chromium.org/14820019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/deep_memory_profiler')
-rw-r--r--tools/deep_memory_profiler/dmprof.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/deep_memory_profiler/dmprof.py b/tools/deep_memory_profiler/dmprof.py
index 190abde..f40414b 100644
--- a/tools/deep_memory_profiler/dmprof.py
+++ b/tools/deep_memory_profiler/dmprof.py
@@ -14,6 +14,7 @@ import re
import subprocess
import sys
import tempfile
+import time
import zipfile
from range_dict import ExclusiveRangeDict
@@ -776,12 +777,15 @@ class Dump(object):
r'^ ([ \(])([a-f0-9]+)([ \)])-([ \(])([a-f0-9]+)([ \)])\s+'
r'(hooked|unhooked)\s+(.+)$', re.IGNORECASE)
- def __init__(self, path, time):
+ _TIME_PATTERN = re.compile(
+ r'^Time: ([0-9]+/[0-9]+/[0-9]+ [0-9]+:[0-9]+:[0-9]+)(\.[0-9]+)?')
+
+ def __init__(self, path, modified_time):
self._path = path
matched = self._PATH_PATTERN.match(path)
self._pid = int(matched.group(2))
self._count = int(matched.group(3))
- self._time = time
+ self._time = modified_time
self._map = {}
self._procmaps = ExclusiveRangeDict(ProcMapsEntryAttribute)
self._stacktrace_lines = []
@@ -844,6 +848,7 @@ class Dump(object):
try:
self._version, ln = self._parse_version()
+ self._parse_meta_information()
if self._version == DUMP_DEEP_6:
self._parse_mmap_list()
self._parse_global_stats()
@@ -917,6 +922,27 @@ class Dump(object):
self._global_stats[prefix + '_virtual'] = int(words[-2])
self._global_stats[prefix + '_committed'] = int(words[-1])
+ def _parse_meta_information(self):
+ """Parses lines in self._lines for meta information."""
+ (ln, found) = skip_while(
+ 0, len(self._lines),
+ lambda n: self._lines[n] != 'META:\n')
+ if not found:
+ return
+ ln += 1
+
+ while True:
+ if self._lines[ln].startswith('Time:'):
+ matched = self._TIME_PATTERN.match(self._lines[ln])
+ if matched:
+ self._time = time.mktime(datetime.datetime.strptime(
+ matched.group(1), '%Y/%m/%d %H:%M:%S').timetuple())
+ if matched.group(2):
+ self._time += float(matched.group(2)[1:]) / 1000.0
+ else:
+ break
+ ln += 1
+
def _parse_mmap_list(self):
"""Parses lines in self._lines as a mmap list."""
(ln, found) = skip_while(