| OLD | NEW |
| 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 optparse | 5 import optparse |
| 6 import re | 6 import re |
| 7 import time | 7 import time |
| 8 | 8 |
| 9 from metrics import v8_object_stats | 9 from metrics import v8_object_stats |
| 10 from telemetry.page import page_measurement | 10 from telemetry.page import page_measurement |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 results.Add(trace_name + '_X', 'seconds', seconds) | 134 results.Add(trace_name + '_X', 'seconds', seconds) |
| 135 else: | 135 else: |
| 136 assert iterations, 'Neither seconds nor iterations given.' | 136 assert iterations, 'Neither seconds nor iterations given.' |
| 137 results.Add(trace_name + '_X', 'iterations', iterations) | 137 results.Add(trace_name + '_X', 'iterations', iterations) |
| 138 results.Add(trace_name + '_Y', units_y, value_y) | 138 results.Add(trace_name + '_Y', units_y, value_y) |
| 139 | 139 |
| 140 # DOM nodes and event listeners | 140 # DOM nodes and event listeners |
| 141 dom_stats = tab.dom_stats | 141 dom_stats = tab.dom_stats |
| 142 dom_node_count = dom_stats['node_count'] | 142 dom_node_count = dom_stats['node_count'] |
| 143 event_listener_count = dom_stats['event_listener_count'] | 143 event_listener_count = dom_stats['event_listener_count'] |
| 144 AddPoint('TotalDOMNodeCount', 'nodes', dom_node_count) | 144 AddPoint('dom_nodes', 'count', dom_node_count) |
| 145 AddPoint('EventListenerCount', 'events', event_listener_count) | 145 AddPoint('event_listeners', 'count', event_listener_count) |
| 146 | 146 |
| 147 # Browser and renderer virtual memory stats | 147 # Browser and renderer virtual memory stats |
| 148 memory_stats = self._browser.memory_stats | 148 memory_stats = self._browser.memory_stats |
| 149 def BrowserVMStats(statistic_name): | 149 def BrowserVMStats(statistic_name): |
| 150 """Get VM stats from the Browser object in KB.""" | 150 """Get VM stats from the Browser object in KB.""" |
| 151 return memory_stats[statistic_name].get('VM', 0) / 1024.0 | 151 return memory_stats[statistic_name].get('VM', 0) / 1024.0 |
| 152 AddPoint('BrowserVirtualMemory', 'KB', BrowserVMStats('Browser')) | 152 AddPoint('browser_vm', 'KB', BrowserVMStats('Browser')) |
| 153 AddPoint('RendererVirtualMemory', 'KB', BrowserVMStats('Renderer')) | 153 AddPoint('renderer_vm', 'KB', BrowserVMStats('Renderer')) |
| 154 AddPoint('gpu_vm', 'KB', BrowserVMStats('Gpu')) |
| 154 | 155 |
| 155 # V8 stats | 156 # V8 stats |
| 156 def V8StatsSum(counters): | 157 def V8StatsSum(counters): |
| 157 """Given a list of V8 counter names, get the sum of the values in KB.""" | 158 """Given a list of V8 counter names, get the sum of the values in KB.""" |
| 158 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) | 159 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) |
| 159 return sum(stats.values()) / 1024.0 | 160 return sum(stats.values()) / 1024.0 |
| 160 AddPoint('V8BytesCommitted', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) | 161 AddPoint('v8_memory_committed', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) |
| 161 AddPoint('V8BytesUsed', 'KB', V8StatsSum(_V8_BYTES_USED)) | 162 AddPoint('v8_memory_used', 'KB', V8StatsSum(_V8_BYTES_USED)) |
| 162 AddPoint('V8MemoryAllocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) | 163 AddPoint('v8_memory_allocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) |
| 163 | 164 |
| OLD | NEW |