Chromium Code Reviews| 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..83234ccfa92a8528df9b4b77be8ea6e90cce68df 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.""" |
| @@ -28,20 +24,7 @@ class MemoryMeasurementPage(page_module.Page): |
| 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): |
| - 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) |
| + self._deterministic_mode = story_set.DETERMINISTIC_MODE |
|
petrcermak
2016/07/07 12:52:11
I don't think you need to store this at all. You s
perezju
2016/08/05 10:50:01
Done.
|
| class ForegroundPage(MemoryMeasurementPage): |
| @@ -54,7 +37,7 @@ class ForegroundPage(MemoryMeasurementPage): |
| def RunPageInteractions(self, action_runner): |
| action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| - self._TakeMemoryMeasurement(action_runner) |
| + action_runner.MeasureMemory(self._deterministic_mode) |
| class BackgroundPage(MemoryMeasurementPage): |
| @@ -76,7 +59,7 @@ class BackgroundPage(MemoryMeasurementPage): |
| app_has_webviews=False) |
| # Take measurement. |
| - self._TakeMemoryMeasurement(action_runner) |
| + action_runner.MeasureMemory(self._deterministic_mode) |
| # Go back to Chrome. |
| android_platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_BACK) |
| @@ -84,6 +67,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 +81,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, no forced GCs nor clearing caches. |
|
petrcermak
2016/07/07 12:52:11
nit: "NEITHER ... nor ..."
perezju
2016/08/05 10:50:01
Done.
|
| + """ |
| + DETERMINISTIC_MODE = False |