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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging
6
7 from lib.deep_dump import DeepDump
8
9 LOGGER = logging.getLogger('dmprof')
10
11 class DumpList(object):
12 """Represents a sequence of heap profile dumps.
13
14 Individual dumps are loaded into memory lazily as the sequence is accessed,
15 either while being iterated through or randomly accessed. Loaded dumps are
16 not cached, meaning a newly loaded Dump object is returned every time an
17 element in the list is accessed.
18 """
19
20 def __init__(self, dump_path_list):
21 self._dump_path_list = dump_path_list
22
23 @staticmethod
24 def load(path_list):
25 return DumpList(path_list)
26
27 def __len__(self):
28 return len(self._dump_path_list)
29
30 def __iter__(self):
31 for dump in self._dump_path_list:
32 yield DeepDump.load(dump)
33
34 def __getitem__(self, index):
35 return DeepDump.load(self._dump_path_list[index])
OLDNEW
« 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