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

Unified Diff: tools/perf/page_sets/memory_health_story.py

Issue 1920363003: Reland of Set up a parallel memory.memory_health_quick_tbmv2 benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/memory_infra.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/memory_health_story.py
diff --git a/tools/perf/page_sets/memory_health_story.py b/tools/perf/page_sets/memory_health_story.py
index e9e912d9876e375428459f544db7110017c31929..0bd52362c1885115c93e370c53db58a14d0a41b7 100644
--- a/tools/perf/page_sets/memory_health_story.py
+++ b/tools/perf/page_sets/memory_health_story.py
@@ -29,17 +29,20 @@
]
-class ForegroundPage(page_module.Page):
- """Take a measurement after loading a regular webpage."""
+class MemoryHealthPage(page_module.Page):
+ """Abstract page class for measuring memory."""
+
+ _PHASE = NotImplemented
def __init__(self, story_set, name, url):
- super(ForegroundPage, self).__init__(
- url=url, page_set=story_set, name=name,
- shared_page_state_class=shared_page_state.SharedMobilePageState)
+ super(MemoryHealthPage, self).__init__(
+ page_set=story_set, name=name, url=url,
+ shared_page_state_class=shared_page_state.SharedMobilePageState,
+ grouping_keys={'phase': self._PHASE})
- def _TakeMemoryMeasurement(self, action_runner, phase):
+ def _TakeMemoryMeasurement(self, action_runner):
action_runner.Wait(1) # See crbug.com/540022#c17.
- with action_runner.CreateInteraction(phase):
+ with action_runner.CreateInteraction(self._PHASE):
action_runner.Wait(DUMP_WAIT_TIME)
action_runner.ForceGarbageCollection()
action_runner.tab.browser.platform.FlushEntireSystemCache()
@@ -47,13 +50,24 @@
if not action_runner.tab.browser.DumpMemory():
logging.error('Unable to get a memory dump for %s.', self.name)
+
+class ForegroundPage(MemoryHealthPage):
+ """Take a measurement after loading a regular webpage."""
+
+ _PHASE = 'foreground'
+
+ def __init__(self, story_set, name, url):
+ super(ForegroundPage, self).__init__(story_set, name, url)
+
def RunPageInteractions(self, action_runner):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
- self._TakeMemoryMeasurement(action_runner, 'foreground')
+ self._TakeMemoryMeasurement(action_runner)
-class BackgroundPage(ForegroundPage):
+class BackgroundPage(MemoryHealthPage):
"""Take a measurement while Chrome is in the background."""
+
+ _PHASE = 'background'
def __init__(self, story_set, name):
super(BackgroundPage, self).__init__(story_set, name, 'about:blank')
@@ -69,7 +83,7 @@
app_has_webviews=False)
# Take measurement.
- self._TakeMemoryMeasurement(action_runner, 'background')
+ self._TakeMemoryMeasurement(action_runner)
# Go back to Chrome.
android_platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_BACK)
« no previous file with comments | « tools/perf/benchmarks/memory_infra.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698