OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from telemetry.value import scalar | 5 from telemetry.value import scalar |
6 | 6 |
7 from metrics import memory | 7 from metrics import memory |
8 from metrics import Metric | 8 from metrics import Metric |
9 | 9 |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 not start_memory_stats[process_type]): | 110 not start_memory_stats[process_type]): |
111 memory_stats[process_type] = end_process_memory | 111 memory_stats[process_type] = end_process_memory |
112 continue | 112 continue |
113 | 113 |
114 if not isinstance(end_process_memory, dict): | 114 if not isinstance(end_process_memory, dict): |
115 start_value = start_memory_stats[process_type] or 0 | 115 start_value = start_memory_stats[process_type] or 0 |
116 memory_stats[process_type] = end_process_memory - start_value | 116 memory_stats[process_type] = end_process_memory - start_value |
117 else: | 117 else: |
118 for metric in end_process_memory: | 118 for metric in end_process_memory: |
119 end_value = end_process_memory[metric] | 119 end_value = end_process_memory[metric] |
120 start_value = start_memory_stats[process_type][metric] or 0 | 120 start_value = start_memory_stats[process_type].get(metric, 0) |
121 if 'Peak' in metric: | 121 if 'Peak' in metric: |
122 memory_stats[process_type][metric] = end_value | 122 memory_stats[process_type][metric] = end_value |
123 else: | 123 else: |
124 memory_stats[process_type][metric] = end_value - start_value | 124 memory_stats[process_type][metric] = end_value - start_value |
125 return memory_stats | 125 return memory_stats |
OLD | NEW |