| Index: tools/perf/page_sets/desktop_memory.py
|
| diff --git a/tools/perf/page_sets/desktop_memory.py b/tools/perf/page_sets/desktop_memory.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7f6d781931ab7edbcbe6de6524a81f1a800c9dda
|
| --- /dev/null
|
| +++ b/tools/perf/page_sets/desktop_memory.py
|
| @@ -0,0 +1,75 @@
|
| +# 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
|
| +import py_utils
|
| +
|
| +from telemetry.page import page as page_module
|
| +from telemetry.page import shared_page_state
|
| +from telemetry import story
|
| +
|
| +_DUMP_WAIT_TIME = 3
|
| +_ITERATIONS = 10
|
| +
|
| +class DesktopMemoryPage(page_module.Page):
|
| +
|
| + def __init__(self, url, page_set):
|
| + super(DesktopMemoryPage, self).__init__(
|
| + url=url, page_set=page_set,
|
| + shared_page_state_class=shared_page_state.SharedDesktopPageState)
|
| +
|
| + def _DumpMemory(self, action_runner, phase):
|
| + with action_runner.CreateInteraction(phase):
|
| + action_runner.Wait(_DUMP_WAIT_TIME)
|
| + action_runner.ForceGarbageCollection()
|
| + action_runner.SimulateMemoryPressureNotification('critical')
|
| + action_runner.Wait(_DUMP_WAIT_TIME)
|
| + # action_runner.MeasureMemory(deterministic_mode=False)
|
| + action_runner.tab.browser.DumpMemory()
|
| +
|
| + def RunPageInteractions(self, action_runner):
|
| + self._DumpMemory(action_runner, 'pre')
|
| + for _ in xrange(_ITERATIONS):
|
| + action_runner.ReloadPage()
|
| +
|
| + tabs = action_runner.tab.browser.tabs
|
| + for _ in xrange(_ITERATIONS):
|
| + new_tab = tabs.New()
|
| + new_tab.action_runner.Navigate(self._url)
|
| + try:
|
| + new_tab.action_runner.WaitForNetworkQuiescence()
|
| + except py_utils.TimeoutException:
|
| + logging.warning('WaitForNetworkQuiescence() timeout')
|
| + new_tab.Close()
|
| +
|
| + self._DumpMemory(action_runner, 'post')
|
| +
|
| +
|
| +class DesktopMemoryPageSet(story.StorySet):
|
| +
|
| + """ Desktop sites with interesting memory characteristics """
|
| +
|
| + def __init__(self):
|
| + super(DesktopMemoryPageSet, self).__init__(
|
| + archive_data_file='data/mobile_memory.json',
|
| + cloud_storage_bucket=story.PARTNER_BUCKET)
|
| +
|
| + urls_list = [
|
| + 'http://www.perdu.com',
|
| + 'http://www.google.com',
|
| + "http://www.live.com",
|
| + "http://www.youtube.com",
|
| + "http://www.wikipedia.org",
|
| + "http://www.flickr.com/",
|
| + "http://www.cnn.com/",
|
| + "http://www.adobe.com/",
|
| + "http://www.aol.com/",
|
| + "http://www.cnet.com/",
|
| + "http://www.godaddy.com/",
|
| + "http://www.walmart.com/",
|
| + "http://www.skype.com/",
|
| + ]
|
| +
|
| + for url in urls_list:
|
| + self.AddStory(DesktopMemoryPage(url, self))
|
| +
|
|
|