Index: tools/perf/page_sets/memory_top_10_mobile.py |
diff --git a/tools/perf/page_sets/memory_top_10_mobile.py b/tools/perf/page_sets/memory_top_10_mobile.py |
index 5f91d70aba79e81573062aa26a98c3ffee75840b..dc105cbeb71c2a056fdd4d8197dad6c8c2af1c6b 100644 |
--- a/tools/perf/page_sets/memory_top_10_mobile.py |
+++ b/tools/perf/page_sets/memory_top_10_mobile.py |
@@ -2,7 +2,6 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import logging |
import re |
from telemetry.page import page as page_module |
@@ -15,9 +14,6 @@ from devil.android.sdk import keyevent # pylint: disable=import-error |
from page_sets import top_10_mobile |
-DUMP_WAIT_TIME = 3 |
- |
- |
class MemoryMeasurementPage(page_module.Page): |
"""Abstract class for measuring memory on a story unit.""" |
@@ -29,20 +25,6 @@ class MemoryMeasurementPage(page_module.Page): |
shared_page_state_class=shared_page_state.SharedMobilePageState, |
grouping_keys={'phase': self._PHASE}) |
- def _TakeMemoryMeasurement(self, action_runner): |
- platform = action_runner.tab.browser.platform |
- action_runner.Wait(1) # See crbug.com/540022#c17. |
- if not platform.tracing_controller.is_tracing_running: |
- logging.warning('Tracing is off. No memory dumps are being recorded.') |
- return # Tracing is not running, e.g., when recording a WPR archive. |
- with action_runner.CreateInteraction(self._PHASE): |
- action_runner.Wait(DUMP_WAIT_TIME) |
- action_runner.ForceGarbageCollection() |
- platform.FlushEntireSystemCache() |
- action_runner.Wait(DUMP_WAIT_TIME) |
- if not action_runner.tab.browser.DumpMemory(): |
- logging.error('Unable to get a memory dump for %s.', self.name) |
- |
class ForegroundPage(MemoryMeasurementPage): |
"""Take a measurement after loading a regular webpage.""" |
@@ -54,7 +36,7 @@ class ForegroundPage(MemoryMeasurementPage): |
def RunPageInteractions(self, action_runner): |
action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
- self._TakeMemoryMeasurement(action_runner) |
+ action_runner.MeasureMemory(self.story_set.DETERMINISTIC_MODE) |
class BackgroundPage(MemoryMeasurementPage): |
@@ -76,7 +58,7 @@ class BackgroundPage(MemoryMeasurementPage): |
app_has_webviews=False) |
# Take measurement. |
- self._TakeMemoryMeasurement(action_runner) |
+ action_runner.MeasureMemory(self.story_set.DETERMINISTIC_MODE) |
# Go back to Chrome. |
android_platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_BACK) |
@@ -84,6 +66,7 @@ class BackgroundPage(MemoryMeasurementPage): |
class MemoryTop10Mobile(story.StorySet): |
"""User story to measure foreground/background memory in top 10 mobile.""" |
+ DETERMINISTIC_MODE = True |
def __init__(self): |
super(MemoryTop10Mobile, self).__init__( |
@@ -97,3 +80,11 @@ class MemoryTop10Mobile(story.StorySet): |
name = re.sub('\W+', '_', url) |
self.AddStory(ForegroundPage(self, name, url)) |
self.AddStory(BackgroundPage(self, 'after_' + name)) |
+ |
+ |
+class MemoryTop10MobileRealistic(MemoryTop10Mobile): |
+ """Top 10 mobile user story in realistic mode. |
+ |
+ This means, in particular, neither forced GCs nor clearing caches. |
+ """ |
+ DETERMINISTIC_MODE = False |