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

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

Issue 692343003: dmprof expand command supports to analyze multiple components with same name in different allocators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix conflict Created 6 years, 1 month 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 | « no previous file | tools/deep_memory_profiler/subcommands/expand.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 2013 The Chromium Authors. All rights reserved. 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 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 json 5 import json
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 9
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return self._rules 118 return self._rules
119 119
120 @property 120 @property
121 def version(self): 121 def version(self):
122 return self._version 122 return self._version
123 123
124 @property 124 @property
125 def components(self): 125 def components(self):
126 return self._components 126 return self._components
127 127
128 def find_rule(self, component_name): 128 def find_rule(self, component_name, after_rule=None):
129 """Finds a rule whose name is |component_name|. """ 129 """Finds a rule whose name is |component_name|.
130
131 If there are multiple rules with same component name,
132 use |after_rule| to search the rule after it.
133 """
134 found_after_rule = False
130 for rule in self._rules: 135 for rule in self._rules:
136 if after_rule and not found_after_rule:
137 if rule == after_rule:
138 found_after_rule = True
139 continue
140
131 if rule.name == component_name: 141 if rule.name == component_name:
132 return rule 142 return rule
133 return None 143 return None
134 144
135 def find_malloc(self, bucket): 145 def find_malloc(self, bucket):
136 """Finds a matching component name which a given |bucket| belongs to. 146 """Finds a matching component name which a given |bucket| belongs to.
137 147
138 Args: 148 Args:
139 bucket: A Bucket object to be searched for. 149 bucket: A Bucket object to be searched for.
140 150
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 @staticmethod 409 @staticmethod
400 def _load_policies(directory): 410 def _load_policies(directory):
401 LOGGER.info('Loading policy files.') 411 LOGGER.info('Loading policy files.')
402 policies = {} 412 policies = {}
403 for label in directory: 413 for label in directory:
404 LOGGER.info(' %s: %s' % (label, directory[label]['file'])) 414 LOGGER.info(' %s: %s' % (label, directory[label]['file']))
405 loaded = Policy.load(directory[label]['file'], directory[label]['format']) 415 loaded = Policy.load(directory[label]['file'], directory[label]['format'])
406 if loaded: 416 if loaded:
407 policies[label] = loaded 417 policies[label] = loaded
408 return PolicySet(policies) 418 return PolicySet(policies)
OLDNEW
« no previous file with comments | « no previous file | tools/deep_memory_profiler/subcommands/expand.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698