Commit 4dbfe756 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

benchmarks: Add a warm story to startup.mobile

For the warm story we avoid flushing caches. Metrics will need more
polishing for properly omitting the first result. This should be done
for the cold benchmark as well, hence we'd still have a good separation
between the benchmark driver and the metrics.

Bug: 760498
Change-Id: Ie061852bd1c8893f5ea57b67c85a383bedf26a7c
Reviewed-on: https://chromium-review.googlesource.com/1203936Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588829}
parent 31e1a2db
......@@ -62,11 +62,12 @@ class _MobileStartupSharedState(story_module.SharedState):
self.platform.network_controller.Close()
self.platform.SetFullPerformanceModeEnabled(False)
def LaunchBrowser(self, url):
self.platform.FlushDnsCache()
# TODO(crbug.com/811244): Determine whether this ensures the page cache is
# cleared after |FlushOsPageCaches()| returns.
self._possible_browser.FlushOsPageCaches()
def LaunchBrowser(self, url, flush_caches):
if flush_caches:
self.platform.FlushDnsCache()
# TODO(crbug.com/811244): Determine whether this ensures the page cache is
# cleared after |FlushOsPageCaches()| returns.
self._possible_browser.FlushOsPageCaches()
self.platform.WaitForBatteryTemperature(35)
self.platform.StartActivity(
intent.Intent(package=self._possible_browser.settings.package,
......@@ -119,21 +120,32 @@ class _MobileStartupSharedState(story_module.SharedState):
return True
def _DriveMobileStartupWithIntent(state, flush_caches):
for _ in xrange(10):
# TODO(pasko): Find a way to fail the benchmark when WPR is set up
# incorrectly and error pages get loaded.
state.LaunchBrowser('http://bbc.co.uk', flush_caches)
with state.FindBrowser() as browser:
action_runner = browser.foreground_tab.action_runner
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
class _MobileStartupWithIntentStory(story_module.Story):
def __init__(self):
super(_MobileStartupWithIntentStory, self).__init__(
_MobileStartupSharedState, name='intent:coldish:bbc')
self._action_runner = None
def Run(self, state):
"""Drives the benchmark with repetitions."""
# TODO(pasko): Find a way to fail the benchmark when WPR is set up
# incorrectly and error pages get loaded.
for _ in xrange(10):
state.LaunchBrowser('http://bbc.co.uk')
with state.FindBrowser() as browser:
action_runner = browser.foreground_tab.action_runner
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
_DriveMobileStartupWithIntent(state, flush_caches=True)
class _MobileStartupWithIntentStoryWarm(story_module.Story):
def __init__(self):
super(_MobileStartupWithIntentStoryWarm, self).__init__(
_MobileStartupSharedState, name='intent:warm:bbc')
def Run(self, state):
_DriveMobileStartupWithIntent(state, flush_caches=False)
class _MobileStartupStorySet(story_module.StorySet):
......@@ -142,6 +154,7 @@ class _MobileStartupStorySet(story_module.StorySet):
archive_data_file='../page_sets/data/startup_pages.json',
cloud_storage_bucket=story_module.PARTNER_BUCKET)
self.AddStory(_MobileStartupWithIntentStory())
self.AddStory(_MobileStartupWithIntentStoryWarm())
# The mobile startup benchmark uses specifics of AndroidPlatform and hardcodes
......
......@@ -3,6 +3,9 @@
"intent:coldish:bbc": {
"DEFAULT": "startup_pages_000.wprgo"
},
"intent:warm:bbc": {
"DEFAULT": "startup_pages_000.wprgo"
},
"http://bbc.co.uk": {
"DEFAULT": "startup_pages_000.wprgo"
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment