Commit 63ae710d authored by Kuo-Hsin Yang's avatar Kuo-Hsin Yang Committed by Commit Bot

[tools/perf] Remove cros_benchmarks

These benchmarks are not used anymore.

Change-Id: I1e1aed69eb108217afe2886491cd8675878a819a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503532Reviewed-by: default avatarCheng-Yu Lee <cylee@chromium.org>
Commit-Queue: Kuo-Hsin Yang <vovoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822616}
parent 0ea75a24
......@@ -875,9 +875,6 @@
'cr_elements': {
'filepath': 'ui/webui/resources/cr_element',
},
'cros_benchmarks': {
'filepath': 'tools/perf/contrib/cros_benchmarks',
},
'cros_reporting': {
'filepath': 'chrome/browser/policy/messaging_layer/'\
'|chrome/browser/chromeos/policy/status_collector/'\
......@@ -2457,9 +2454,6 @@
'ukai+cc@chromium.org',
'yyanagisawa+cc@chromium.org'],
'cr_elements': ['michaelpg+watch-elements@chromium.org'],
'cros_benchmarks': ['cros-perf-detectives@google.com',
'cywang@chromium.org',
'vovoy@chromium.org'],
'cros_reporting': ['cros-reporting-reviews@google.com'],
'crostini': ['crostini-ui@chromium.org'],
'cups_printing': ['print-reviews+cups@chromium.org',
......
*.wprgo
*.fetchts
data/send_key_tab_switch
bccheng@chromium.org
deanliao@chromium.org
vovoy@chromium.org
lozano@chromium.org
laszio@chromium.org
cylee@chromium.org
# Copyright 2017 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
import subprocess
import time
def _RunCommand(dut_ip, cmd):
"""Runs command on the DUT.
Args:
dut_ip: IP of the DUT. If it's None, runs command locally.
cmd: The command to run.
"""
if dut_ip:
# Commands via ssh shall be double-quoted to escape special characters.
cmd = '"%s"' % cmd
return os.system('ssh root@%s %s' % (dut_ip, cmd))
else:
return os.system(cmd)
def _Popen(dut_ip, cmd_list):
"""Popen to run a command on DUT."""
if dut_ip:
cmd_list = ['ssh', 'root@' + dut_ip] + cmd_list
return subprocess.Popen(cmd_list, stdout=subprocess.PIPE)
def _CopyToDUT(dut_ip, local_path, dut_path):
"""Copies file to the DUT path."""
if dut_ip:
os.system('scp -q %s root@%s:%s' % (local_path, dut_ip, dut_path))
else:
os.system('cp %s %s' % (local_path, dut_path))
class KeyboardEmulator(object):
"""Sets up a remote emulated keyboard and sends key events to switch tab.
Example usage:
with KeyboardEmulator(DUT_IP) as kbd:
for i in range(5):
kbd.SwitchTab()
"""
REMOTE_TEMP_DIR = '/usr/local/tmp/'
REMOTE_LOG_KEY_FILENAME = 'log_key_tab_switch'
REMOTE_KEY_PROP_FILENAME = 'keyboard.prop'
def __init__(self, dut_ip):
"""Inits KeyboardEmulator.
Args:
dut_ip: DUT IP or hostname.
"""
self._dut_ip = dut_ip
self._key_device_name = None
def _StartRemoteKeyboardEmulator(self):
"""Starts keyboard emulator on the DUT.
Returns:
The device name of the emulated keyboard.
Raises:
RuntimeError: Keyboard emulation failed.
"""
kbd_prop_filename = os.path.join(KeyboardEmulator.REMOTE_TEMP_DIR,
KeyboardEmulator.REMOTE_KEY_PROP_FILENAME)
ret = _RunCommand(self._dut_ip, 'test -e %s' % kbd_prop_filename)
if ret != 0:
raise RuntimeError('Keyboard property file does not exist.')
process = _Popen(self._dut_ip, ['evemu-device', kbd_prop_filename])
# The evemu-device output format:
# Emulated Keyboard: /dev/input/event10
output = process.stdout.readline()
if self._dut_ip:
# The remote process would live when the ssh process was terminated.
process.kill()
else:
# Needs extra sleep when running locally, otherwise the first key may not
# dispatch.
# TODO(cywang): crbug.com/852702
time.sleep(1)
if not output.startswith('Emulated Keyboard:'):
raise RuntimeError('Keyboard emulation failed.')
key_device_name = output.split()[2]
return key_device_name
def _SetupKeyDispatch(self):
"""Uploads required files to emulate keyboard."""
cur_dir = os.path.dirname(os.path.abspath(__file__))
for filename in (KeyboardEmulator.REMOTE_KEY_PROP_FILENAME,
KeyboardEmulator.REMOTE_LOG_KEY_FILENAME):
src = os.path.join(cur_dir, 'data', filename)
dest = os.path.join(KeyboardEmulator.REMOTE_TEMP_DIR, filename)
_CopyToDUT(self._dut_ip, src, dest)
def __enter__(self):
self._SetupKeyDispatch()
self._key_device_name = self._StartRemoteKeyboardEmulator()
return self
def SwitchTab(self):
"""Sending Ctrl-tab key to trigger tab switching."""
log_key_filename = os.path.join(KeyboardEmulator.REMOTE_TEMP_DIR,
KeyboardEmulator.REMOTE_LOG_KEY_FILENAME)
cmd = ('evemu-play --insert-slot0 %s < %s' %
(self._key_device_name, log_key_filename))
_RunCommand(self._dut_ip, cmd)
def __exit__(self, exc_type, exc_value, traceback):
# Kills the emulator process explicitly.
_RunCommand(self._dut_ip, 'pkill evemu-device')
def NoScreenOff(dut_ip):
"""Sets screen always on for 1 hour.
Args:
dut_ip: DUT IP or hostname.
"""
_RunCommand(dut_ip, 'set_power_policy --ac_screen_off_delay=3600')
_RunCommand(dut_ip, 'set_power_policy --ac_screen_dim_delay=3600')
N: Emulated Keyboard
I: 0003 0461 4e05 0111
P: 00 00 00 00 00 00 00 00
B: 00 13 00 12 00 00 00 00 00
B: 01 fe ff ff ff ff ff ff ff
B: 01 ff ff ef ff df ff be fe
B: 01 ff 57 40 c1 7a 20 9f ff
B: 01 07 00 00 00 00 00 01 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 00 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 00 00 00 00 00 00 00 00
B: 11 1f 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
E: 1494933813.802943 0004 0004 29
E: 1494933813.802943 0001 001d 1
E: 1494933813.802943 0000 0000 0
E: 1494933813.986151 0004 0004 15
E: 1494933813.986151 0001 000f 1
E: 1494933813.986151 0000 0000 0
E: 1494933814.128580 0004 0004 29
E: 1494933814.128580 0001 001d 0
E: 1494933814.128580 0000 0000 0
E: 1494933814.131678 0004 0004 15
E: 1494933814.131678 0001 000f 0
E: 1494933814.131678 0000 0000 0
{
"archives": {
"cros_tab_switching_typical24": {
"DEFAULT": "tab_switching.wprgo"
}
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
"platform_specific": true
}
42341cef9c0292dd30179051f674cdc0800dd19b
\ No newline at end of file
# Copyright 2017 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 core import perf_benchmark
from core import platforms
from contrib.cros_benchmarks import tab_switching_stories
from telemetry import benchmark
from telemetry import story
from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import timeline_based_measurement
@benchmark.Info(emails=['vovoy@chromium.org'],
component='OS>Performance')
class CrosTabSwitchingTypical24(perf_benchmark.PerfBenchmark):
"""Measures tab switching performance with 24 tabs.
The script opens 24 pages in 24 different tabs, waits for them to load,
and then switches to each tabs and measures the tabs paint time. The 24
pages were chosen from Alexa top ranking sites. Tab paint time is the
time between tab being requested and the first paint event.
Benchmark specific option:
--tabset-repeat=N: Duplicate tab set for N times.
--pause-after-creation=N: Pauses N secs after tab creation.
--pause-after-switch=N: Pauses N secs after each tab switch.
The following usage example opens 120 tabs.
$ ./run_benchmark --browser=cros-chrome --remote=DUT_IP
cros_tab_switching.typical_24 --tabset-repeat=5
"""
# TODO(rmhasan): Remove the SUPPORTED_PLATFORMS lists.
# SUPPORTED_PLATFORMS is deprecated, please put system specifier tags
# from expectations.config in SUPPORTED_PLATFORM_TAGS.
SUPPORTED_PLATFORM_TAGS = [platforms.CHROMEOS]
SUPPORTED_PLATFORMS = [story.expectations.ALL_CHROMEOS]
@classmethod
def AddBenchmarkCommandLineArgs(cls, parser):
parser.add_option('--tabset-repeat', type='int', default=1,
help='repeat tab page set')
parser.add_option('--pause-after-creation', type='int', default=0,
help='pause between tab creation and tab switch')
parser.add_option('--pause-after-switch', type='int', default=3,
help='pause between each tab switch')
def CreateStorySet(self, options):
# When running this test with test_that, fetch_benchmark_deps.py would
# invoke this method. Options doesn't have attribute cros_remote in this
# case.
cros_remote = getattr(options, 'cros_remote', None)
story_set = story.StorySet(
archive_data_file='data/tab_switching.json',
base_dir=os.path.dirname(os.path.abspath(__file__)),
cloud_storage_bucket=story.PARTNER_BUCKET)
story_set.AddStory(tab_switching_stories.CrosMultiTabTypical24Story(
story_set, cros_remote, options.tabset_repeat,
options.pause_after_creation, options.pause_after_switch))
return story_set
def CreateCoreTimelineBasedMeasurementOptions(self):
category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter()
category_filter.AddIncludedCategory('latency')
options = timeline_based_measurement.Options(category_filter)
options.SetTimelineBasedMetrics(['tabsMetric'])
return options
@classmethod
def Name(cls):
return 'cros_tab_switching.typical_24'
# Copyright 2017 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.
from __future__ import print_function
import logging
import time
import py_utils
from telemetry.core import exceptions
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from contrib.cros_benchmarks import cros_utils
# NOTE: When tab count is high, some tabs may be discarded, and the tab
# context would be invalidated. Avoid storing tab object for later use.
class CrosMultiTabStory(page_module.Page):
"""Base class for multi-tab stories."""
def __init__(self, story_set, cros_remote, tabset_repeat=1,
pause_after_creation=0, pause_after_switch=3):
super(CrosMultiTabStory, self).__init__(
shared_page_state_class=shared_page_state.SharedPageState,
page_set=story_set, name=self.NAME, url=self.URL)
# cros_remote is the DUT IP or None if running locally.
self._cros_remote = cros_remote
self._tabset_repeat = tabset_repeat
self._pause_after_creation = pause_after_creation
self._pause_after_switch = pause_after_switch
def RunNavigateSteps(self, action_runner):
"""Opening tabs and waiting for them to load."""
if not self._cros_remote and not py_utils.IsRunningOnCrosDevice():
raise ValueError('Must specify --remote=DUT_IP to run this test, '
'or run it on CrOS locally.')
# As this story may run for a long time, adjusting screen off time to
# avoid screen off.
cros_utils.NoScreenOff(self._cros_remote)
tabs = action_runner.tab.browser.tabs
# No need to create the first tab as there is already one
# when the browser is ready.
url_list = self.URL_LIST * self._tabset_repeat
if url_list:
action_runner.Navigate(url_list[0])
for i, url in enumerate(url_list[1:]):
new_tab = tabs.New()
try:
new_tab.action_runner.Navigate(url)
except exceptions.DevtoolsTargetCrashException:
logging.info('Navigate: devtools context lost')
if i % 10 == 0:
print('opening tab:', i)
# Waiting for every tabs to be stable.
for i, url in enumerate(url_list):
try:
tabs[i].action_runner.WaitForNetworkQuiescence()
except py_utils.TimeoutException:
logging.info('WaitForNetworkQuiescence() timeout, url[%d]: %s',
i, url)
except exceptions.DevtoolsTargetCrashException:
logging.info('WaitForNetworkQuiescence: devtools context lost')
def RunPageInteractions(self, action_runner):
"""Tab switching to each tabs."""
url_list = self.URL_LIST * self._tabset_repeat
browser = action_runner.tab.browser
total_tab_count = len(url_list)
live_tab_count = len(browser.tabs)
if live_tab_count != total_tab_count:
logging.warning('live tab: %d, tab discarded: %d',
live_tab_count, total_tab_count - live_tab_count)
time.sleep(self._pause_after_creation)
with cros_utils.KeyboardEmulator(self._cros_remote) as keyboard:
for i in range(total_tab_count):
keyboard.SwitchTab()
time.sleep(self._pause_after_switch)
if i % 10 == 0:
print('switching tab:', i)
class CrosMultiTabTypical24Story(CrosMultiTabStory):
"""Multi-tab stories to test 24 typical webpages."""
NAME = 'cros_tab_switching_typical24'
URL_LIST = [
# Why: Alexa games #48
'http://www.nick.com/games',
# Why: Alexa sports #45
'http://www.rei.com/',
# Why: Alexa sports #50
'http://www.fifa.com/',
# Why: Alexa shopping #41
'http://www.gamestop.com/ps3',
# Why: Alexa news #55
('http://www.economist.com/news/science-and-technology/21573529-small-'
'models-cosmic-phenomena-are-shedding-light-real-thing-how-build'),
# Why: Alexa news #67
'http://www.theonion.com',
'http://arstechnica.com/',
# Why: Alexa home #10
'http://allrecipes.com/Recipe/Pull-Apart-Hot-Cross-Buns/Detail.aspx',
'http://www.html5rocks.com/en/',
'http://www.mlb.com/',
('http://gawker.com/5939683/based-on-a-true-story-is-a-rotten-lie-i-'
'hope-you-never-believe'),
'http://www.imdb.com/title/tt0910970/',
'http://www.flickr.com/search/?q=monkeys&f=hp',
'http://money.cnn.com/',
'http://www.nationalgeographic.com/',
'http://premierleague.com',
'http://www.osubeavers.com/',
'http://walgreens.com',
'http://colorado.edu',
('http://www.ticketmaster.com/JAY-Z-and-Justin-Timberlake-tickets/artist/'
'1837448?brand=none&tm_link=tm_homeA_rc_name2'),
# pylint: disable=line-too-long
'http://www.theverge.com/2013/3/5/4061684/inside-ted-the-smartest-bubble-in-the-world',
'http://www.airbnb.com/',
'http://www.ign.com/',
# Why: Alexa health #25
'http://www.fda.gov',
]
URL = URL_LIST[0]
# Copyright 2018 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.
from core import perf_benchmark
from core import platforms
import page_sets
from telemetry import benchmark
from telemetry import story as story_module
from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import timeline_based_measurement
@benchmark.Info(emails=['chiniforooshan@chromium.org', 'sadrul@chromium.org'])
class CrosUiSmoothnessBenchmark(perf_benchmark.PerfBenchmark):
"""Measures ChromeOS UI smoothness."""
page_set = page_sets.CrosUiCasesPageSet
# TODO(rmhasan): Remove the SUPPORTED_PLATFORMS lists.
# SUPPORTED_PLATFORMS is deprecated, please put system specifier tags
# from expectations.config in SUPPORTED_PLATFORM_TAGS.
SUPPORTED_PLATFORM_TAGS = [platforms.CHROMEOS]
SUPPORTED_PLATFORMS = [story_module.expectations.ALL_CHROMEOS]
@classmethod
def Name(cls):
return 'cros_ui_smoothness'
def CreateCoreTimelineBasedMeasurementOptions(self):
category_filter = chrome_trace_category_filter.CreateLowOverheadFilter()
options = timeline_based_measurement.Options(category_filter)
options.config.chrome_trace_config.EnableUMAHistograms(
'Event.Latency.ScrollBegin.Touch.TimeToScrollUpdateSwapBegin4',
'Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin4')
options.SetTimelineBasedMetrics(['renderingMetric', 'umaMetric'])
return options
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