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

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

Issue 141563014: Make dmprof handle long runs better (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add notes to DumpList class documentation. Created 6 years, 11 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/subcommands/cat.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/lib/dump.py
diff --git a/tools/deep_memory_profiler/lib/dump.py b/tools/deep_memory_profiler/lib/dump.py
index dc4b89840c09b3afb1466979b3813f39afdb0612..c207f64bb3bc2b73fdd9f17b849c5642d8c15482 100644
--- a/tools/deep_memory_profiler/lib/dump.py
+++ b/tools/deep_memory_profiler/lib/dump.py
@@ -407,28 +407,30 @@ class Dump(object):
class DumpList(object):
- """Represents a sequence of heap profile dumps."""
+ """Represents a sequence of heap profile dumps.
- def __init__(self, dump_list):
- self._dump_list = dump_list
+ 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):
- LOGGER.info('Loading heap dump profiles.')
- dump_list = []
- for path in path_list:
- dump_list.append(Dump.load(path, ' '))
- return DumpList(dump_list)
+ return DumpList(path_list)
def __len__(self):
- return len(self._dump_list)
+ return len(self._dump_path_list)
def __iter__(self):
- for dump in self._dump_list:
- yield dump
+ for dump in self._dump_path_list:
+ yield Dump.load(dump)
def __getitem__(self, index):
- return self._dump_list[index]
+ return Dump.load(self._dump_path_list[index])
class ProcMapsEntryAttribute(ExclusiveRangeDict.RangeAttribute):
« no previous file with comments | « no previous file | tools/deep_memory_profiler/subcommands/cat.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698