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

Unified Diff: tools/deep_memory_profiler/lib/deep_dump.py

Issue 371303002: Refactor dmprof: split lib.Dump into lib.Dump and lib.DeepDump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | tools/deep_memory_profiler/lib/dump.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/lib/deep_dump.py
diff --git a/tools/deep_memory_profiler/lib/dump.py b/tools/deep_memory_profiler/lib/deep_dump.py
similarity index 94%
copy from tools/deep_memory_profiler/lib/dump.py
copy to tools/deep_memory_profiler/lib/deep_dump.py
index 1fa4fc3b698860092dd7f36d432ecd0b03bbeefb..dc37ea0c7764d65f4daf26f22a90aa917172769d 100644
--- a/tools/deep_memory_profiler/lib/dump.py
+++ b/tools/deep_memory_profiler/lib/deep_dump.py
@@ -1,4 +1,4 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
+# Copyright 2014 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.
@@ -9,6 +9,7 @@ import os
import re
import time
+from lib.dump import Dump
from lib.exceptions import EmptyDumpException, InvalidDumpException
from lib.exceptions import ObsoleteDumpVersionException, ParsingException
from lib.pageframe import PageFrame
@@ -44,7 +45,7 @@ DUMP_DEEP_5 = 'DUMP_DEEP_5'
DUMP_DEEP_6 = 'DUMP_DEEP_6'
-class Dump(object):
+class DeepDump(Dump):
"""Represents a heap profile dump."""
_PATH_PATTERN = re.compile(r'^(.*)\.([0-9]+)\.([0-9]+)\.heap$')
@@ -66,6 +67,7 @@ class Dump(object):
_TIME_PATTERN_SECONDS = re.compile(r'^Time: ([0-9]+)$')
def __init__(self, path, modified_time):
+ super(DeepDump, self).__init__()
self._path = path
matched = self._PATH_PATTERN.match(path)
self._pid = int(matched.group(2))
@@ -407,33 +409,6 @@ class Dump(object):
return True
-class DumpList(object):
- """Represents a sequence of heap profile dumps.
-
- Individual dumps are loaded into memory lazily as the sequence is accessed,
- either while being iterated through or randomly accessed. Loaded dumps are
- not cached, meaning a newly loaded Dump object is returned every time an
- element in the list is accessed.
- """
-
- def __init__(self, dump_path_list):
- self._dump_path_list = dump_path_list
-
- @staticmethod
- def load(path_list):
- return DumpList(path_list)
-
- def __len__(self):
- return len(self._dump_path_list)
-
- def __iter__(self):
- for dump in self._dump_path_list:
- yield Dump.load(dump)
-
- def __getitem__(self, index):
- return Dump.load(self._dump_path_list[index])
-
-
class ProcMapsEntryAttribute(ExclusiveRangeDict.RangeAttribute):
"""Represents an entry of /proc/maps in range_dict.ExclusiveRangeDict."""
_DUMMY_ENTRY = procfs.ProcMapsEntry(
« no previous file with comments | « no previous file | tools/deep_memory_profiler/lib/dump.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698