Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: tools/perf/measurements/tab_switching.py

Issue 178363005: [Telemetry] Measure power in tab_switching measurement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart browser after each test iteration Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/benchmarks/tab_switching.py ('k') | tools/perf/page_sets/five_blank_pages.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/measurements/tab_switching.py
diff --git a/tools/perf/measurements/tab_switching.py b/tools/perf/measurements/tab_switching.py
index 982f05f8c5d8ad6dc618f8d41ee3c73f8169da38..6a78493b725c7369256645c2a2a99de9b6fbdf58 100644
--- a/tools/perf/measurements/tab_switching.py
+++ b/tools/perf/measurements/tab_switching.py
@@ -7,12 +7,13 @@
This measurement opens pages in different tabs. After all the tabs have opened,
it cycles through each tab in sequence, and records a histogram of the time
between when a tab was first requested to be shown, and when it was painted.
+Power usage is also measured.
"""
import time
-from metrics import cpu
from metrics import histogram_util
+from metrics import power
from telemetry.core import util
from telemetry.page import page_measurement
@@ -21,30 +22,44 @@ from telemetry.page import page_measurement
class TabSwitching(page_measurement.PageMeasurement):
def __init__(self):
super(TabSwitching, self).__init__()
- self._cpu_metric = None
+ self._first_page_in_pageset = True
+ self._power_metric = power.PowerMetric()
def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs([
'--enable-stats-collection-bindings'
])
+ power.PowerMetric.CustomizeBrowserOptions(options)
+
+ def DidStartBrowser(self, browser):
+ self._first_page_in_pageset = True
def TabForPage(self, page, browser):
+ if self._first_page_in_pageset:
+ # The initial browser window contains a single tab, navigate that tab
+ # rather than creating a new one.
+ self._first_page_in_pageset = False
+ return browser.tabs[0]
+
return browser.tabs.New()
- def DidStartBrowser(self, browser):
- self._cpu_metric = cpu.CpuMetric(browser)
+ def StopBrowserAfterPage(self, browser, page):
+ # Restart the browser after the last page in the pageset.
+ return len(browser.tabs) >= len(page.page_set.pages)
def MeasurePage(self, page, tab, results):
"""On the last tab, cycle through each tab that was opened and then record
a single histogram for the tab switching metric."""
if len(tab.browser.tabs) != len(page.page_set.pages):
return
- self._cpu_metric.Start(page, tab)
- time.sleep(.5)
- self._cpu_metric.Stop(page, tab)
- # Calculate the idle cpu load before any actions are done.
- self._cpu_metric.AddResults(tab, results,
- 'idle_cpu_utilization')
+
+ # Measure power usage of tabs after quiescence.
+ util.WaitFor(tab.HasReachedQuiescence, 60)
+
+ self._power_metric.Start(page, tab)
+ time.sleep(5)
+ self._power_metric.Stop(page, tab)
+ self._power_metric.AddResults(tab, results,)
histogram_name = 'MPArch.RWH_TabSwitchPaintDuration'
histogram_type = histogram_util.BROWSER_HISTOGRAM
« no previous file with comments | « tools/perf/benchmarks/tab_switching.py ('k') | tools/perf/page_sets/five_blank_pages.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698