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

Side by Side Diff: tools/deep_memory_profiler/lib/range_dict.py

Issue 19346002: Refactor dmprof: Split dmprof.py into modules. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/deep_memory_profiler/lib/policy.py ('k') | tools/deep_memory_profiler/lib/sorter.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 import sys 6 import sys
7 7
8 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) 8 _BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9 BINTREES_PATH = os.path.join( 9 _BINTREES_PATH = os.path.join(
10 BASE_PATH, os.pardir, os.pardir, 'third_party', 'bintrees') 10 _BASE_PATH, os.pardir, os.pardir, 'third_party', 'bintrees')
11 sys.path.insert(0, BINTREES_PATH) 11 sys.path.insert(0, _BINTREES_PATH)
12 12
13 from bintrees import FastRBTree # pylint: disable=F0401 13 from bintrees import FastRBTree # pylint: disable=F0401
14 14
15 15
16 class ExclusiveRangeDict(object): 16 class ExclusiveRangeDict(object):
17 """A class like dict whose key is a range [begin, end) of integers. 17 """A class like dict whose key is a range [begin, end) of integers.
18 18
19 It has an attribute for each range of integers, for example: 19 It has an attribute for each range of integers, for example:
20 [10, 20) => Attribute(0), 20 [10, 20) => Attribute(0),
21 [20, 40) => Attribute(1), 21 [20, 40) => Attribute(1),
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 prev_end = range_end 135 prev_end = range_end
136 136
137 for missing_begin, missing_end in missing_ranges: 137 for missing_begin, missing_end in missing_ranges:
138 self._tree[missing_begin] = (missing_end, self._attr()) 138 self._tree[missing_begin] = (missing_end, self._attr())
139 139
140 for range_begin, range_value in self._tree.itemslice(begin, end): 140 for range_begin, range_value in self._tree.itemslice(begin, end):
141 yield range_begin, range_value[0], range_value[1] 141 yield range_begin, range_value[0], range_value[1]
142 142
143 def __str__(self): 143 def __str__(self):
144 return str(self._tree) 144 return str(self._tree)
OLDNEW
« no previous file with comments | « tools/deep_memory_profiler/lib/policy.py ('k') | tools/deep_memory_profiler/lib/sorter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698