Index: tools/deep_memory_profiler/lib/policy.py |
diff --git a/tools/deep_memory_profiler/lib/policy.py b/tools/deep_memory_profiler/lib/policy.py |
index 2a41bb25106740ffa1ca695a5b50ff81bea5163b..a9776f34a0f34fbc10afc4899faa2a781d9926c8 100644 |
--- a/tools/deep_memory_profiler/lib/policy.py |
+++ b/tools/deep_memory_profiler/lib/policy.py |
@@ -125,9 +125,19 @@ class Policy(object): |
def components(self): |
return self._components |
- def find_rule(self, component_name): |
- """Finds a rule whose name is |component_name|. """ |
+ def find_rule(self, component_name, after_rule=None): |
+ """Finds a rule whose name is |component_name|. |
+ |
+ If there are multiple rules with same component name, |
+ use |after_rule| to search the rule after it. |
+ """ |
+ found_after_rule = False |
for rule in self._rules: |
+ if after_rule and not found_after_rule: |
+ if rule == after_rule: |
+ found_after_rule = True |
+ continue |
+ |
if rule.name == component_name: |
return rule |
return None |