Commit 5b1847df authored by ulan's avatar ulan Committed by Commit bot

Add benchmark that imitates news reading.

Each story in the benchmark does the following:
1. Load the main page.
2. Open and scroll the first news item.
3. Go back to the main page and scroll it.
4. Open and scroll the second news item.
5. Go back to the main page and scroll it.
6. etc.

This workflow is interesting because it is close to real world
and generates a lot of garbage by creating and discarding pages.

A couple of websites crash with OOM on svelte device, so by
tracking and optimizing for this benchmark we can improve
user experience on low-memory devices.

*** NOTE TO SHERRIF ***
Regressions are expected in system_health.memory_mobile and
system_health.memory_desktop for the following stories:
- load:news:cnn
- load:social:facebook
- load:news:qq
- load:news:reddit
- load:social:twitter

If there are failing tests in form of benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.*
please do not revert this CL but instead disabling failing
test by adding them into the _DISABLE_TESTS list in
tools/perf/benchmarks/system_health_smoke_test.py

BUG=589726
CQ_INCLUDE_TRYBOTS=tryserver.chromium.perf:android_s5_perf_cq;tryserver.chromium.perf:mac_retina_perf_cq

Review-Url: https://codereview.chromium.org/2118293002
Cr-Commit-Position: refs/heads/master@{#405212}
parent 92294e78
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
from core import perf_benchmark
from telemetry.timeline import chrome_trace_config
from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import timeline_based_measurement
import page_sets
# See tr.v.Numeric.getSummarizedScalarNumericsWithNames()
# https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value/numeric.html#L323
_IGNORED_MEMORY_STATS_RE = re.compile(r'_(std|count|min|sum|pct_\d{4}(_\d+)?)$')
# Track only the high-level GC stats to reduce the data load on dashboard.
_IGNORED_V8_STATS_RE = re.compile(
r'_(idle_deadline_overrun|percentage_idle|outside_idle)')
_V8_GC_HIGH_LEVEL_STATS_RE = re.compile(r'^v8-gc-('
r'full-mark-compactor_|'
r'incremental-finalize_|'
r'incremental-step_|'
r'latency-mark-compactor_|'
r'memory-mark-compactor_|'
r'scavenger_|'
r'total_)')
class _V8BrowsingBenchmark(perf_benchmark.PerfBenchmark):
"""Base class for V8 browsing benchmarks.
This benchmark measures memory usage with periodic memory dumps and v8 times.
See browsing_stories._BrowsingStory for workload description.
"""
def CreateTimelineBasedMeasurementOptions(self):
categories = [
# Disable all categories by default.
'-*',
# Memory categories.
'disabled-by-default-memory-infra',
# V8 categories.
'blink.console',
'disabled-by-default-v8.gc',
'renderer.scheduler',
'v8',
'webkit.console',
]
options = timeline_based_measurement.Options(
chrome_trace_category_filter.ChromeTraceCategoryFilter(
','.join(categories)))
options.config.enable_android_graphics_memtrack = True
# Trigger periodic light memory dumps every 1000 ms.
memory_dump_config = chrome_trace_config.MemoryDumpConfig()
memory_dump_config.AddTrigger('light', 1000)
options.config.chrome_trace_config.SetMemoryDumpConfig(memory_dump_config)
options.SetTimelineBasedMetrics(['v8AndMemoryMetrics'])
return options
@classmethod
def Name(cls):
return 'v8.browsing_%s' % cls.page_set.PLATFORM
@classmethod
def ValueCanBeAddedPredicate(cls, value, is_first_result):
# TODO(crbug.com/610962): Remove this stopgap when the perf dashboard
# is able to cope with the data load generated by TBMv2 metrics.
if 'memory:chrome' in value.name:
return ('renderer_processes' in value.name and
not _IGNORED_MEMORY_STATS_RE.search(value.name))
return (_V8_GC_HIGH_LEVEL_STATS_RE.search(value.name) and
not _IGNORED_V8_STATS_RE.search(value.name))
@classmethod
def ShouldTearDownStateAfterEachStoryRun(cls):
return True
class V8DesktopBrowsingBenchmark(_V8BrowsingBenchmark):
page_set = page_sets.DesktopBrowsingSystemHealthStorySet
@classmethod
def ShouldDisable(cls, possible_browser):
return possible_browser.platform.GetDeviceTypeName() != 'Desktop'
class V8MobileBrowsingBenchmark(_V8BrowsingBenchmark):
page_set = page_sets.MobileBrowsingSystemHealthStorySet
@classmethod
def ShouldDisable(cls, possible_browser):
return possible_browser.platform.GetDeviceTypeName() == 'Desktop'
{
"archives": {
"browsing_desktop_000.wpr": [
"browse:news:cnn"
],
"browsing_desktop_001.wpr": [
"browse:news:hackernews"
],
"browsing_desktop_002.wpr": [
"browse:news:nytimes"
],
"browsing_desktop_003.wpr": [
"browse:news:reddit"
],
"browsing_desktop_004.wpr": [
"browse:social:twitter"
]
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating."
}
\ No newline at end of file
13fe92dcc66c3e400ef23544dc08e76a44c5c2cc
\ No newline at end of file
ddafadda57bd321ecf0986622e2714687a159b0d
\ No newline at end of file
1ca9c8f6a5561391f45f953db7106e194551f4bf
\ No newline at end of file
bc072ce9c4cb3aa8994b3482cdf1a214ce17cda2
\ No newline at end of file
ca0fac3dcddf978c424334f7e3e4f5a589e98a4f
\ No newline at end of file
{
"archives": {
"browsing_mobile_000.wpr": [
"browse:news:cnn"
],
"browsing_mobile_001.wpr": [
"browse:social:facebook"
],
"browsing_mobile_002.wpr": [
"browse:news:hackernews"
],
"browsing_mobile_003.wpr": [
"browse:news:nytimes"
],
"browsing_mobile_004.wpr": [
"browse:news:qq"
],
"browsing_mobile_005.wpr": [
"browse:news:reddit"
],
"browsing_mobile_006.wpr": [
"browse:social:twitter"
],
"browsing_mobile_007.wpr": [
"browse:news:washingtonpost"
]
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating."
}
\ No newline at end of file
62e374b145af2b28056fd56d34b3296a4277691e
\ No newline at end of file
354566d7ceab53c5565ff0176ce94a00ce8bcd04
\ No newline at end of file
3ae16f1f04f80ab673e8318bda02b1f751f9fd2d
\ No newline at end of file
2faf0483fd16b14acb1b1a914c86e5d98df13777
\ No newline at end of file
0961ce5e04b7136a2e7c72cd7f3a07410a26b29d
\ No newline at end of file
88a33657d9f684b408af397137e31324d6ec054e
\ No newline at end of file
1ce38b106fd3166eaae36fc51997f3772f2465bb
\ No newline at end of file
b729e3ea1e7453eaabd6c0d0c4aed7def830e74f
\ No newline at end of file
{
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"memory_system_health_desktop_004.wpr": [
"load:tools:drive",
"load:tools:docs",
"load:tools:gmail",
"load:tools:maps",
"load:tools:stackoverflow",
"load:tools:dropbox",
"load:tools:weather"
],
"memory_system_health_desktop_002.wpr": [
"load:news:cnn",
"load:news:reddit",
"load:news:qq",
"load:news:bbc",
"load:news:wikipedia"
],
"memory_system_health_desktop_005.wpr": [
"load:games:spychase",
"load:games:alphabetty",
"load:games:bubbles",
"load:games:miniclip",
"load:games:lazors"
],
"memory_system_health_desktop_000.wpr": [
"load:search:amazon",
"load:search:flipkart",
"load:search:ebay",
"load:search:google",
"load:search:yandex",
"load:search:taobao",
"load:search:yahoo",
"load:search:amazon",
"load:search:flipkart",
"load:search:ebay",
"load:search:google",
"load:search:yandex",
"load:search:taobao",
"load:search:yahoo",
"load:search:baidu"
],
"memory_system_health_desktop_003.wpr": [
"load:media:soundcloud",
"load:media:dailymotion",
"load:media:9gag",
"load:media:flickr",
"load:media:google_images",
"load:media:youtube"
],
],
"memory_system_health_desktop_001.wpr": [
"load:social:facebook",
"load:social:instagram",
"load:social:twitter",
"load:social:pinterest",
"load:social:vk",
"load:social:instagram",
"load:social:pinterest",
"load:social:vk",
"load:social:tumblr"
],
"memory_system_health_desktop_002.wpr": [
"load:news:bbc",
"load:news:wikipedia"
],
"memory_system_health_desktop_003.wpr": [
"load:media:soundcloud",
"load:media:dailymotion",
"load:media:9gag",
"load:media:flickr",
"load:media:google_images",
"load:media:youtube"
],
"memory_system_health_desktop_004.wpr": [
"load:tools:drive",
"load:tools:docs",
"load:tools:gmail",
"load:tools:maps",
"load:tools:stackoverflow",
"load:tools:dropbox",
"load:tools:weather"
],
"memory_system_health_desktop_005.wpr": [
"load:games:spychase",
"load:games:alphabetty",
"load:games:bubbles",
"load:games:miniclip",
"load:games:lazors"
],
"memory_system_health_desktop_006.wpr": [
"load:news:cnn"
],
"memory_system_health_desktop_007.wpr": [
"load:social:facebook"
],
"memory_system_health_desktop_008.wpr": [
"load:news:hackernews"
],
"memory_system_health_desktop_009.wpr": [
"load:news:nytimes"
],
"memory_system_health_desktop_010.wpr": [
"load:news:qq"
],
"memory_system_health_desktop_011.wpr": [
"load:news:reddit"
],
"memory_system_health_desktop_012.wpr": [
"load:social:twitter"
]
}
}
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating."
}
\ No newline at end of file
dbe6febc6e15c21ac96a6991d625bdb28e4458f1
\ No newline at end of file
8e70124ca04148babe5daf9627fbb099b76e7667
\ No newline at end of file
e22ffae4bbc81029f1966383d9dd17748cfe9b77
\ No newline at end of file
fdc4dc2cb02cb20a843ebb66645ae693860bdee7
\ No newline at end of file
cee43a0b4da2b4b3a9f6859dd5759326d832f24f
\ No newline at end of file
ff746570bb75d6ba3cdfbe57091fbc0dddfe7caf
\ No newline at end of file
5146bd1a30d4e76fe4136d8a80bd0d279a8b6e43
\ No newline at end of file
{
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"memory_system_health_mobile_005.wpr": [
"load:games:lazors",
"load:games:bubbles",
"load:games:spychase"
],
"memory_system_health_mobile_004.wpr": [
"load:tools:gmail",
"load:tools:maps",
"load:tools:stackoverflow",
"load:tools:dropbox",
"load:tools:weather",
"load:tools:drive",
"load:tools:docs"
],
"memory_system_health_mobile_001.wpr": [
"load:social:facebook",
"load:social:tumblr",
"load:social:twitter",
"load:social:pinterest",
"load:social:instagram"
],
"memory_system_health_mobile_003.wpr": [
"load:media:9gag",
"load:media:google_images",
"load:media:soundcloud",
"load:media:youtube",
"load:media:dailymotion",
"load:media:flickr"
],
"memory_system_health_mobile_000.wpr": [
"load:search:amazon",
"load:search:baidu",
"load:search:yandex",
"load:search:google",
"load:search:taobao",
"load:search:ebay",
"load:search:amazon",
"load:search:baidu",
"load:search:yandex",
"load:search:google",
"load:search:taobao",
"load:search:ebay",
"load:search:yahoo"
],
],
"memory_system_health_mobile_001.wpr": [
"load:social:tumblr",
"load:social:pinterest",
"load:social:instagram"
],
"memory_system_health_mobile_002.wpr": [
"load:news:cnn",
"load:news:reddit",
"load:news:sohu",
"load:news:qq",
"load:news:bbc",
"load:news:sohu",
"load:news:bbc",
"load:news:wikipedia"
],
"memory_system_health_mobile_003.wpr": [
"load:media:9gag",
"load:media:google_images",
"load:media:soundcloud",
"load:media:youtube",
"load:media:dailymotion",
"load:media:flickr"
],
"memory_system_health_mobile_004.wpr": [
"load:tools:gmail",
"load:tools:maps",
"load:tools:stackoverflow",
"load:tools:dropbox",
"load:tools:weather",
"load:tools:drive",
"load:tools:docs"
],
"memory_system_health_mobile_005.wpr": [
"load:games:lazors",
"load:games:bubbles",
"load:games:spychase"
],
"memory_system_health_mobile_006.wpr": [
"load:news:cnn"
],
"memory_system_health_mobile_007.wpr": [
"load:social:facebook"
],
"memory_system_health_mobile_008.wpr": [
"load:news:hackernews"
],
"memory_system_health_mobile_009.wpr": [
"load:news:nytimes"
],
"memory_system_health_mobile_010.wpr": [
"load:news:qq"
],
"memory_system_health_mobile_011.wpr": [
"load:news:reddit"
],
"memory_system_health_mobile_012.wpr": [
"load:social:twitter"
],
"memory_system_health_mobile_013.wpr": [
"load:news:washingtonpost"
]
}
}
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating."
}
\ No newline at end of file
7f86b3192dafcd133065c28898393df8c12fb941
\ No newline at end of file
eda06f1a8e7783a84c9ee72a88553fac2048a081
\ No newline at end of file
4fa19911cab200add04a6595d65ff0934bc3bb5d
\ No newline at end of file
53eb718c4ec046aabc4d0a17a72de51322788cdf
\ No newline at end of file
305273a313ba302c603c7684246d84d239763720
\ No newline at end of file
911fe0063555bef9df83f173a93a83711efccf49
\ No newline at end of file
30744e43b62592745a8d54a3d8d1bda3809f1240
\ No newline at end of file
2e9a97079fa89da7a4769c36f832234d641d4712
\ No newline at end of file
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
from page_sets.system_health import platforms
from page_sets.system_health import system_health_story
from telemetry import story
class _BrowsingStory(system_health_story.SystemHealthStory):
"""Abstract base class for browsing stories.
A browsing story visits items on the main page. Subclasses provide
CSS selector to identify the items and implement interaction using
the helper methods of this class.
"""
IS_SINGLE_PAGE_APP = False
ITEM_SELECTOR = NotImplemented
ITEMS_TO_VISIT = 4
def __init__(self, story_set):
super(_BrowsingStory, self).__init__(
story_set, take_memory_measurement=False)
def _WaitForNavigation(self, action_runner):
if not self.IS_SINGLE_PAGE_APP:
action_runner.WaitForNavigate()
def _NavigateToItem(self, action_runner, index):
item_selector = 'document.querySelectorAll("%s")[%d]' % (
self.ITEM_SELECTOR, index)
self._ClickLink(action_runner, item_selector)
def _ClickLink(self, action_runner, element_function):
action_runner.WaitForElement(element_function=element_function)
action_runner.ClickElement(element_function=element_function)
self._WaitForNavigation(action_runner)
def _NavigateBack(self, action_runner):
action_runner.ExecuteJavaScript('window.history.back()')
self._WaitForNavigation(action_runner)
class _NewsBrowsingStory(_BrowsingStory):
"""Abstract base class for news user stories.
A news story imitates browsing a news website:
1. Load the main page.
2. Open and scroll the first news item.
3. Go back to the main page and scroll it.
4. Open and scroll the second news item.
5. Go back to the main page and scroll it.
6. etc.
"""
ITEM_READ_TIME_IN_SECONDS = 3
ITEM_SCROLL_REPEAT = 2
MAIN_PAGE_SCROLL_REPEAT = 0
def _DidLoadDocument(self, action_runner):
for i in xrange(self.ITEMS_TO_VISIT):
self._NavigateToItem(action_runner, i)
self._ReadNewsItem(action_runner)
self._NavigateBack(action_runner)
self._ScrollMainPage(action_runner)
def _ReadNewsItem(self, action_runner):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS)
action_runner.RepeatableBrowserDrivenScroll(
repeat_count=self.ITEM_SCROLL_REPEAT)
def _ScrollMainPage(self, action_runner):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
action_runner.RepeatableBrowserDrivenScroll(
repeat_count=self.MAIN_PAGE_SCROLL_REPEAT)
##############################################################################
# News browsing stories.
##############################################################################
class CnnStory(_NewsBrowsingStory):
"""The second top website in http://www.alexa.com/topsites/category/News"""
NAME = 'browse:news:cnn'
URL = 'http://edition.cnn.com/'
ITEM_SELECTOR = '.cd__content > h3 > a'
ITEMS_TO_VISIT = 2
# TODO(ulan): Enable this story on mobile once it uses less memory and
# does not crash with OOM.
SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
class FacebookMobileStory(_NewsBrowsingStory):
NAME = 'browse:social:facebook'
URL = 'https://www.facebook.com/rihanna'
ITEM_SELECTOR = 'article ._5msj'
# Facebook on desktop is not interesting because it embeds post comments
# directly in the main timeline.
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
class HackerNewsStory(_NewsBrowsingStory):
NAME = 'browse:news:hackernews'
URL = 'https://news.ycombinator.com'
ITEM_SELECTOR = '.athing .title > a'
class NytimesMobileStory(_NewsBrowsingStory):
"""The third top website in http://www.alexa.com/topsites/category/News"""
NAME = 'browse:news:nytimes'
URL = 'http://mobile.nytimes.com'
ITEM_SELECTOR = '.sfgAsset-link'
# Visiting more items causes OOM.
ITEMS_TO_VISIT = 2
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
class NytimesDesktopStory(_NewsBrowsingStory):
"""The third top website in http://www.alexa.com/topsites/category/News"""
NAME = 'browse:news:nytimes'
URL = 'http://www.nytimes.com'
ITEM_SELECTOR = '.story-heading > a'
SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
class QqMobileStory(_NewsBrowsingStory):
NAME = 'browse:news:qq'
URL = 'http://news.qq.com'
# Desktop qq.com opens a news item in a separate tab, for which the back
# button does not work.
# Mobile qq.com is disabled due to crbug.com/627166
ITEM_SELECTOR = '.list .full a'
SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS
class RedditDesktopStory(_NewsBrowsingStory):
"""The top website in http://www.alexa.com/topsites/category/News"""
NAME = 'browse:news:reddit'
URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
ITEM_SELECTOR = '.thing .title > a'
SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
class RedditMobileStory(_NewsBrowsingStory):
"""The top website in http://www.alexa.com/topsites/category/News"""
NAME = 'browse:news:reddit'
URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
IS_SINGLE_PAGE_APP = True
ITEM_SELECTOR = '.PostHeader__post-title-line'
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
class TwitterMobileStory(_NewsBrowsingStory):
NAME = 'browse:social:twitter'
URL = 'https://www.twitter.com/justinbieber?skip_interstitial=true'
ITEM_SELECTOR = '.Tweet-text'
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
class TwitterDesktopStory(_NewsBrowsingStory):
NAME = 'browse:social:twitter'
URL = 'https://www.twitter.com/justinbieber?skip_interstitial=true'
IS_SINGLE_PAGE_APP = True
ITEM_SELECTOR = '.tweet-text'
SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
class WashingtonPostMobileStory(_NewsBrowsingStory):
"""Progressive website"""
NAME = 'browse:news:washingtonpost'
URL = 'https://www.washingtonpost.com/pwa'
IS_SINGLE_PAGE_APP = True
ITEM_SELECTOR = '.hed > a'
SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
def _DidLoadDocument(self, action_runner):
# Close the popup window.
action_runner.ClickElement(selector='.close')
super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner)
##############################################################################
# Browsing story sets.
##############################################################################
def _IterAllNewsBrowsingStoryClasses():
return system_health_story.IterAllStoryClasses(
sys.modules[__name__], _NewsBrowsingStory)
class _BrowsingSystemHealthStorySet(story.StorySet):
PLATFORM = NotImplemented
def __init__(self):
super(_BrowsingSystemHealthStorySet, self).__init__(
archive_data_file=('../data/browsing_%s.json' % self.PLATFORM),
cloud_storage_bucket=story.PARTNER_BUCKET)
for story_class in _IterAllNewsBrowsingStoryClasses():
if self.PLATFORM not in story_class.SUPPORTED_PLATFORMS:
continue
self.AddStory(story_class(self))
class DesktopBrowsingSystemHealthStorySet(_BrowsingSystemHealthStorySet):
PLATFORM = platforms.DESKTOP
class MobileBrowsingSystemHealthStorySet(_BrowsingSystemHealthStorySet):
PLATFORM = platforms.MOBILE
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DESKTOP = 'desktop'
MOBILE = 'mobile'
ALL_PLATFORMS = frozenset({DESKTOP, MOBILE})
DESKTOP_ONLY = frozenset({DESKTOP})
MOBILE_ONLY = frozenset({MOBILE})
# This is used for disabling a story on all platforms.
NO_PLATFORMS = frozenset()
......@@ -2,7 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from page_sets.system_health import single_page_stories
from page_sets.system_health import platforms
from page_sets.system_health import loading_stories
from telemetry import story
......@@ -19,7 +20,7 @@ class _SystemHealthStorySet(story.StorySet):
archive_data_file=('../data/memory_system_health_%s.json' %
self.PLATFORM),
cloud_storage_bucket=story.PARTNER_BUCKET)
for story_class in single_page_stories.IterAllStoryClasses():
for story_class in loading_stories.IterAllStoryClasses():
if self.PLATFORM not in story_class.SUPPORTED_PLATFORMS:
continue
self.AddStory(story_class(self, take_memory_measurement))
......@@ -27,9 +28,9 @@ class _SystemHealthStorySet(story.StorySet):
class DesktopSystemHealthStorySet(_SystemHealthStorySet):
"""Desktop user stories for Chrome System Health Plan."""
PLATFORM = 'desktop'
PLATFORM = platforms.DESKTOP
class MobileSystemHealthStorySet(_SystemHealthStorySet):
"""Mobile user stories for Chrome System Health Plan."""
PLATFORM = 'mobile'
PLATFORM = platforms.MOBILE
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from page_sets.system_health import platforms
from telemetry.core import discover
from telemetry.page import page
_DUMP_WAIT_TIME = 3
class SystemHealthStory(page.Page):
"""Abstract base class for System Health user stories."""
# The full name of a single page story has the form CASE:GROUP:PAGE (e.g.
# 'load:search:google').
NAME = NotImplemented
URL = NotImplemented
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
def __init__(self, story_set, take_memory_measurement):
case, group, _ = self.NAME.split(':')
super(SystemHealthStory, self).__init__(
page_set=story_set, name=self.NAME, url=self.URL,
credentials_path='../data/credentials.json',
grouping_keys={'case': case, 'group': group})
self._take_memory_measurement = take_memory_measurement
def _Measure(self, action_runner):
if not self._take_memory_measurement:
return
# TODO(petrcermak): This method is essentially the same as
# MemoryHealthPage._TakeMemoryMeasurement() in memory_health_story.py.
# Consider sharing the common code.
action_runner.Wait(_DUMP_WAIT_TIME)
action_runner.ForceGarbageCollection()
action_runner.Wait(_DUMP_WAIT_TIME)
tracing_controller = action_runner.tab.browser.platform.tracing_controller
if not tracing_controller.is_tracing_running:
return # Tracing is not running, e.g., when recording a WPR archive.
if not action_runner.tab.browser.DumpMemory():
logging.error('Unable to get a memory dump for %s.', self.name)
def _Login(self, action_runner):
pass
def _DidLoadDocument(self, action_runner):
pass
def RunNavigateSteps(self, action_runner):
self._Login(action_runner)
super(SystemHealthStory, self).RunNavigateSteps(action_runner)
def RunPageInteractions(self, action_runner):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
self._DidLoadDocument(action_runner)
self._Measure(action_runner)
def IterAllStoryClasses(module, base_class):
# Sort the classes by their names so that their order is stable and
# deterministic.
for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule(
module=module,
base_class=base_class,
index_by_class_name=True).iteritems()):
yield cls
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