| 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 """The tab switching measurement. | 5 """The tab switching measurement. |
| 6 | 6 |
| 7 This measurement opens pages in different tabs. After all the tabs have opened, | 7 This measurement opens pages in different tabs. After all the tabs have opened, |
| 8 it cycles through each tab in sequence, and records a histogram of the time | 8 it cycles through each tab in sequence, and records a histogram of the time |
| 9 between when a tab was first requested to be shown, and when it was painted. | 9 between when a tab was first requested to be shown, and when it was painted. |
| 10 Power usage is also measured. | 10 Power usage is also measured. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 def MeasurePage(self, page, tab, results): | 51 def MeasurePage(self, page, tab, results): |
| 52 """On the last tab, cycle through each tab that was opened and then record | 52 """On the last tab, cycle through each tab that was opened and then record |
| 53 a single histogram for the tab switching metric.""" | 53 a single histogram for the tab switching metric.""" |
| 54 if len(tab.browser.tabs) != len(page.page_set.pages): | 54 if len(tab.browser.tabs) != len(page.page_set.pages): |
| 55 return | 55 return |
| 56 | 56 |
| 57 # Measure power usage of tabs after quiescence. | 57 # Measure power usage of tabs after quiescence. |
| 58 util.WaitFor(tab.HasReachedQuiescence, 60) | 58 util.WaitFor(tab.HasReachedQuiescence, 60) |
| 59 | 59 |
| 60 self._power_metric.Start(page, tab) | 60 self._power_metric.Start(page, tab) |
| 61 time.sleep(5) | 61 time.sleep(60) |
| 62 self._power_metric.Stop(page, tab) | 62 self._power_metric.Stop(page, tab) |
| 63 self._power_metric.AddResults(tab, results,) | 63 self._power_metric.AddResults(tab, results,) |
| 64 | 64 |
| 65 histogram_name = 'MPArch.RWH_TabSwitchPaintDuration' | 65 histogram_name = 'MPArch.RWH_TabSwitchPaintDuration' |
| 66 histogram_type = histogram_util.BROWSER_HISTOGRAM | 66 histogram_type = histogram_util.BROWSER_HISTOGRAM |
| 67 display_name = 'MPArch_RWH_TabSwitchPaintDuration' | 67 display_name = 'MPArch_RWH_TabSwitchPaintDuration' |
| 68 first_histogram = histogram_util.GetHistogram( | 68 first_histogram = histogram_util.GetHistogram( |
| 69 histogram_type, histogram_name, tab) | 69 histogram_type, histogram_name, tab) |
| 70 prev_histogram = first_histogram | 70 prev_histogram = first_histogram |
| 71 | 71 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 last_histogram = histogram_util.GetHistogram( | 85 last_histogram = histogram_util.GetHistogram( |
| 86 histogram_type, histogram_name, tab) | 86 histogram_type, histogram_name, tab) |
| 87 diff_histogram = histogram_util.SubtractHistogram(last_histogram, | 87 diff_histogram = histogram_util.SubtractHistogram(last_histogram, |
| 88 first_histogram) | 88 first_histogram) |
| 89 | 89 |
| 90 results.AddSummaryValue( | 90 results.AddSummaryValue( |
| 91 histogram.HistogramValue(None, display_name, '', | 91 histogram.HistogramValue(None, display_name, '', |
| 92 raw_value_json=diff_histogram, | 92 raw_value_json=diff_histogram, |
| 93 important=False)) | 93 important=False)) |
| OLD | NEW |