Commit 22ead273 authored by ulan's avatar ulan Committed by Commit bot

Add benchmark that tests garbage collector and idle time handler.

High memory usage is forced by duplicate tabs in the same process.

BUG=
CQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_perf_bisect;tryserver.chromium.perf:win_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect

Review URL: https://codereview.chromium.org/1145173002

Cr-Commit-Position: refs/heads/master@{#330930}
parent 42e801f5
......@@ -41,3 +41,21 @@ class MemoryTop7StressWithSlimmingPaint(benchmark.Benchmark):
@classmethod
def Name(cls):
return 'memory.top_7_stress_slimming_paint'
@benchmark.Enabled('has tabs')
@benchmark.Disabled('android') # Benchmark uses > 700MB of memory.
class MemoryIdleMultiTab(benchmark.Benchmark):
"""Use (recorded) real world web sites and measure memory consumption
with many tabs and idle times. """
test = memory.Memory
page_set = page_sets.IdleMultiTabCasesPageSet
def CustomizeBrowserOptions(self, options):
# This benchmark opens tabs from JavaScript, which does not work
# with popup-blocking enabled.
options.AppendExtraBrowserArgs(['--disable-popup-blocking'])
@classmethod
def Name(cls):
return 'memory.idle_multi_tab'
\ No newline at end of file
// Copyright 2015 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.
__telemetry_spawned_tabs = [];
function __telemetry_spawn_tab() {
var tab = window.open(window.location.href);
if (typeof tab === "undefined") {
throw "Cannot open tab. Forgot --disable-popup-blocking flag?";
}
__telemetry_spawned_tabs.push(tab);
return __telemetry_spawned_tabs.length - 1;
}
function __telemetry_close_tab(tab) {
__telemetry_spawned_tabs[tab].close();
__telemetry_spawned_tabs[tab] = null;
}
# Copyright 2015 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 os
from telemetry.page import page_set as page_set_module
from page_sets import top_pages
from page_sets import top_7_stress
def _SpawnTab(action_runner):
return action_runner.EvaluateJavaScript('__telemetry_spawn_tab()')
def _CloseTab(action_runner, tab):
action_runner.EvaluateJavaScript('__telemetry_close_tab(' + str(tab) + ')')
def _CreateIdleMultiTabPageClass(base_page_cls, base_js):
class DerivedIdleMultiTabPage(base_page_cls): # pylint: disable=W0232
def RunPageInteractions(self, action_runner):
MAX_TABS = 10
action_runner.ExecuteJavaScript(base_js)
tabs = {}
# Slowly open tabs.
for tab in xrange(MAX_TABS):
tabs[tab] = _SpawnTab(action_runner)
action_runner.Wait(1)
action_runner.Wait(20)
# Slowly close tabs.
for tab in xrange(MAX_TABS):
_CloseTab(action_runner, tabs[tab])
action_runner.Wait(1)
action_runner.Wait(30)
# Quickly open tabs.
for tab in xrange(MAX_TABS):
tabs[tab] = _SpawnTab(action_runner)
action_runner.Wait(20)
# Quickly close tabs.
for tab in xrange(MAX_TABS):
_CloseTab(action_runner, tabs[tab])
action_runner.Wait(30)
return DerivedIdleMultiTabPage
class IdleMultiTabCasesPageSet(page_set_module.PageSet):
""" Pages for testing GC efficiency on idle pages. """
def __init__(self):
super(IdleMultiTabCasesPageSet, self).__init__(
user_agent_type='desktop',
archive_data_file='data/top_25.json',
bucket=page_set_module.PARTNER_BUCKET)
with open(os.path.join(os.path.dirname(__file__),
'idle_multi_tab_cases.js')) as f:
base_js = f.read()
pages = [
top_pages.GoogleDocPage,
top_7_stress.GmailPage,
top_7_stress.GooglePlusPage,
]
for page in pages:
self.AddUserStory(_CreateIdleMultiTabPageClass(page, base_js)(self))
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