Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 if seconds: | 116 if seconds: |
| 117 results.Add(trace_name + '_X', 'seconds', seconds) | 117 results.Add(trace_name + '_X', 'seconds', seconds) |
| 118 else: | 118 else: |
| 119 assert iterations, 'Neither seconds nor iterations given.' | 119 assert iterations, 'Neither seconds nor iterations given.' |
| 120 results.Add(trace_name + '_X', 'seconds', iterations) | 120 results.Add(trace_name + '_X', 'seconds', iterations) |
| 121 results.Add(trace_name + '_Y', units_y, value_y) | 121 results.Add(trace_name + '_Y', units_y, value_y) |
| 122 | 122 |
| 123 # DOM nodes and event listeners | 123 # DOM nodes and event listeners |
| 124 dom_node_count = tab.dom_stats['node_count'] | 124 dom_node_count = tab.dom_stats['node_count'] |
| 125 event_listener_count = tab.dom_stats['event_listener_count'] | 125 event_listener_count = tab.dom_stats['event_listener_count'] |
| 126 AddPoint('TotalDOMNodeCount', 'nodes', dom_node_count) | 126 AddPoint('dom_nodes', 'count', dom_node_count) |
| 127 AddPoint('EventListenerCount', 'events', event_listener_count) | 127 AddPoint('event_listeners', 'count', event_listener_count) |
|
Michael Achenbach
2013/09/19 10:49:04
Ignore my comment on the last CL. "count" is stric
| |
| 128 | 128 |
| 129 # Browser and renderer virtual memory stats | 129 # Browser and renderer virtual memory stats |
| 130 def BrowserVMStats(statistic_name): | 130 def BrowserVMStats(statistic_name): |
| 131 """Get VM stats from the Browser object in KB.""" | 131 """Get VM stats from the Browser object in KB.""" |
| 132 return self._browser.memory_stats[statistic_name].get('VM', 0) / 1024.0 | 132 return self._browser.memory_stats[statistic_name].get('VM', 0) / 1024.0 |
| 133 AddPoint('BrowserVirtualMemory', 'KB', BrowserVMStats('Browser')) | 133 AddPoint('browser_vm', 'KB', BrowserVMStats('Browser')) |
| 134 AddPoint('RendererVirtualMemory', 'KB', BrowserVMStats('Renderer')) | 134 AddPoint('renderer_vm', 'KB', BrowserVMStats('Renderer')) |
| 135 AddPoint('gpu_vm', 'KB', BrowserVMStats('Gpu')) | |
|
Michael Achenbach
2013/09/19 10:49:04
Hope the abbreviation vm will not confuse. But I l
Michael Achenbach
2013/09/19 10:49:04
I can't say anything about the 'Gpu' string. But a
| |
| 135 | 136 |
| 136 # V8 stats | 137 # V8 stats |
| 137 def V8StatsSum(counters): | 138 def V8StatsSum(counters): |
| 138 """Given a list of V8 counter names, get the sum of the values in KB.""" | 139 """Given a list of V8 counter names, get the sum of the values in KB.""" |
| 139 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) | 140 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) |
| 140 return sum(stats.values()) / 1024.0 | 141 return sum(stats.values()) / 1024.0 |
| 141 AddPoint('V8BytesCommitted', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) | 142 AddPoint('v8_memory_committed', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) |
| 142 AddPoint('V8BytesUsed', 'KB', V8StatsSum(_V8_BYTES_USED)) | 143 AddPoint('v8_memory_used', 'KB', V8StatsSum(_V8_BYTES_USED)) |
| 143 AddPoint('V8MemoryAllocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) | 144 AddPoint('v8_memory_allocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) |
|
Michael Achenbach
2013/09/19 10:49:04
Good one! Unit and trace name were not very consis
| |
| 144 | 145 |
| OLD | NEW |