| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 def DidStartBrowser(self, browser): | 70 def DidStartBrowser(self, browser): |
| 71 # Save the Browser object so that memory_stats can be gotten later. | 71 # Save the Browser object so that memory_stats can be gotten later. |
| 72 self._browser = browser | 72 self._browser = browser |
| 73 | 73 |
| 74 def CustomizeBrowserOptions(self, options): | 74 def CustomizeBrowserOptions(self, options): |
| 75 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) | 75 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) |
| 76 | 76 |
| 77 def CanRunForPage(self, page): | 77 def CanRunForPage(self, page): |
| 78 return hasattr(page, 'endure') | 78 return hasattr(page, 'endure') |
| 79 | 79 |
| 80 def WillRunPageRepeats(self, page, tab): | 80 def WillRunPageRepeats(self, page): |
| 81 """Set-up before starting a new page.""" | 81 """Set-up before starting a new page.""" |
| 82 # Reset the starting time for each new page. | 82 # Reset the starting time for each new page. |
| 83 self._start_time = time.time() | 83 self._start_time = time.time() |
| 84 | 84 |
| 85 # Prefix the page name so it can be picked up by the buildbot script that | 85 # Prefix the page name so it can be picked up by the buildbot script that |
| 86 # parses Endure output. | 86 # parses Endure output. |
| 87 if page.name and not page.display_name.startswith('endure_'): | 87 if page.name and not page.display_name.startswith('endure_'): |
| 88 page.name = 'endure_' + page.name | 88 page.name = 'endure_' + page.name |
| 89 | 89 |
| 90 def MeasurePage(self, page, tab, results): | 90 def MeasurePage(self, page, tab, results): |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 # V8 stats | 156 # V8 stats |
| 157 def V8StatsSum(counters): | 157 def V8StatsSum(counters): |
| 158 """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.""" |
| 159 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) | 159 stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) |
| 160 return sum(stats.values()) / 1024.0 | 160 return sum(stats.values()) / 1024.0 |
| 161 AddPoint('v8_memory_committed', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) | 161 AddPoint('v8_memory_committed', 'KB', V8StatsSum(_V8_BYTES_COMMITTED)) |
| 162 AddPoint('v8_memory_used', 'KB', V8StatsSum(_V8_BYTES_USED)) | 162 AddPoint('v8_memory_used', 'KB', V8StatsSum(_V8_BYTES_USED)) |
| 163 AddPoint('v8_memory_allocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) | 163 AddPoint('v8_memory_allocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED)) |
| 164 | 164 |
| OLD | NEW |