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

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

Issue 754203004: There is a cyclic import in dmprof Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/deep_memory_profiler/lib/dump.py ('k') | tools/deep_memory_profiler/lib/subcommand.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/lib/dumplist.py
diff --git a/tools/deep_memory_profiler/lib/dumplist.py b/tools/deep_memory_profiler/lib/dumplist.py
new file mode 100644
index 0000000000000000000000000000000000000000..47df91ef07b0244488be9366170db2b799c1fccd
--- /dev/null
+++ b/tools/deep_memory_profiler/lib/dumplist.py
@@ -0,0 +1,35 @@
+# Copyright 2013 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.
+
+import logging
+
+from lib.deep_dump import DeepDump
+
+LOGGER = logging.getLogger('dmprof')
+
+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 DeepDump.load(dump)
+
+ def __getitem__(self, index):
+ return DeepDump.load(self._dump_path_list[index])
« no previous file with comments | « tools/deep_memory_profiler/lib/dump.py ('k') | tools/deep_memory_profiler/lib/subcommand.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698