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

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: 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, follow_rule=None):
kouhei (in TOK) 2014/11/04 18:17:03 follow_rule -> after?
wensheng 2014/11/05 01:46:17 Yes
129 """Finds a rule whose name is |component_name|. """ 129 """Finds a rule whose name is |component_name|. """
kouhei (in TOK) 2014/11/04 18:17:03 Please update comment.
wensheng 2014/11/05 01:46:17 Done.
130 flag = False
kouhei (in TOK) 2014/11/04 18:17:03 please use more descriptive variable name.
wensheng 2014/11/05 01:46:17 Done.
130 for rule in self._rules: 131 for rule in self._rules:
132 if follow_rule and not flag:
133 if rule == follow_rule:
134 flag = True
135 continue
136
131 if rule.name == component_name: 137 if rule.name == component_name:
132 return rule 138 return rule
133 return None 139 return None
134 140
135 def find_malloc(self, bucket): 141 def find_malloc(self, bucket):
136 """Finds a matching component name which a given |bucket| belongs to. 142 """Finds a matching component name which a given |bucket| belongs to.
137 143
138 Args: 144 Args:
139 bucket: A Bucket object to be searched for. 145 bucket: A Bucket object to be searched for.
140 146
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 @staticmethod 405 @staticmethod
400 def _load_policies(directory): 406 def _load_policies(directory):
401 LOGGER.info('Loading policy files.') 407 LOGGER.info('Loading policy files.')
402 policies = {} 408 policies = {}
403 for label in directory: 409 for label in directory:
404 LOGGER.info(' %s: %s' % (label, directory[label]['file'])) 410 LOGGER.info(' %s: %s' % (label, directory[label]['file']))
405 loaded = Policy.load(directory[label]['file'], directory[label]['format']) 411 loaded = Policy.load(directory[label]['file'], directory[label]['format'])
406 if loaded: 412 if loaded:
407 policies[label] = loaded 413 policies[label] = loaded
408 return PolicySet(policies) 414 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