Commit 63fff39d authored by shimazu's avatar shimazu Committed by Commit bot

ServiceWorker: Separate micro benchmark from application benchmark

Currently both of two are measured by one metric, but there is no meaning of JavaScript measurements in application test and of Speed Index in micro benchmark. This patch separate the two types of performance tests into different page_sets, and different measurements.

BUG=372759
TEST=./tools/perf/run_benchmark --browser=android-chrome-shell service_worker.service_worker
TEST=./tools/perf/run_benchmark --browser=android-chrome-shell service_worker.service_worker_micro_benchmark

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

Cr-Commit-Position: refs/heads/master@{#302521}
parent 311d5b84
......@@ -15,6 +15,7 @@ from telemetry.timeline import async_slice as async_slice_module
from telemetry.timeline import slice as slice_module
from telemetry.value import scalar
class _ServiceWorkerTimelineMetric(object):
def AddResultsOfCounters(self, process, counter_regex_string, results):
counter_filter = re.compile(counter_regex_string)
......@@ -82,6 +83,8 @@ class _ServiceWorkerTimelineMetric(object):
class _ServiceWorkerMeasurement(page_test.PageTest):
"""Measure Speed Index and TRACE_EVENTs"""
def __init__(self, *args, **kwargs):
super(_ServiceWorkerMeasurement, self).__init__(*args, **kwargs)
self._timeline_controller = timeline_controller.TimelineController()
......@@ -99,17 +102,9 @@ class _ServiceWorkerMeasurement(page_test.PageTest):
self._speed_index.Start(page, tab)
def ValidateAndMeasurePage(self, page, tab, results):
tab.WaitForJavaScriptExpression(
'(window.done == null) ? ' +
'(document.readyState == "complete") : window.done', 40)
tab.WaitForDocumentReadyStateToBeComplete(40)
self._timeline_controller.Stop(tab)
# Measure JavaScript-land
json = tab.EvaluateJavaScript('window.results || {}')
for key, value in json.iteritems():
results.AddValue(scalar.ScalarValue(
results.current_page, key, value['units'], value['value']))
# Retrieve TRACE_EVENTs
timeline_metric = _ServiceWorkerTimelineMetric()
browser_process = self._timeline_controller.model.browser_process
......@@ -138,8 +133,55 @@ class _ServiceWorkerMeasurement(page_test.PageTest):
chart_prefix += '_later'
self._speed_index.AddResults(tab, results, chart_prefix)
class _ServiceWorkerMicroBenchmarkMeasurement(page_test.PageTest):
"""Measure JS land values and TRACE_EVENTs"""
def __init__(self, *args, **kwargs):
super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__(*args,
**kwargs)
self._timeline_controller = timeline_controller.TimelineController()
def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs([
'--enable-experimental-web-platform-features'
])
def WillNavigateToPage(self, page, tab):
self._timeline_controller.SetUp(page, tab)
self._timeline_controller.Start(tab)
def ValidateAndMeasurePage(self, page, tab, results):
tab.WaitForJavaScriptExpression('window.done', 40)
self._timeline_controller.Stop(tab)
# Measure JavaScript-land
json = tab.EvaluateJavaScript('window.results || {}')
for key, value in json.iteritems():
results.AddValue(scalar.ScalarValue(
results.current_page, key, value['units'], value['value']))
# Retrieve TRACE_EVENTs
timeline_metric = _ServiceWorkerTimelineMetric()
browser_process = self._timeline_controller.model.browser_process
filter_text = '(RegisterServiceWorker|'\
'UnregisterServiceWorker|'\
'ProcessAllocate|'\
'FindRegistrationForDocument|'\
'DispatchFetchEvent)'
timeline_metric.AddResultsOfEvents(
browser_process, 'IOThread', filter_text , results)
@benchmark.Enabled('android')
class ServiceWorkerPerfTest(benchmark.Benchmark):
"""Performance test on pages controlled by ServiceWorker"""
"""Performance test on public applications using ServiceWorker"""
test = _ServiceWorkerMeasurement
page_set = page_sets.ServiceWorkerPageSet
@benchmark.Enabled('android')
class ServiceWorkerMicroBenchmarkPerfTest(benchmark.Benchmark):
"""Service Worker performance test using a micro benchmark page set"""
test = _ServiceWorkerMicroBenchmarkMeasurement
page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet
{
"description": "Describes the Web Page Replay archives for a page set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"service_worker_034.wpr": [
"http://localhost:8091/many-registration.html",
"http://localhost:8091/index.html",
"service_worker_037.wpr": [
"https://jakearchibald.github.io/trained-to-thrill/"
]
}
}
}
\ No newline at end of file
eccdcfdb5a632acec971c50e1ee0573e0781569e
\ No newline at end of file
19068c5e1c817f3918a16cb96c3d1f765399eb37
\ No newline at end of file
{
"description": "Describes the Web Page Replay archives for a page set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"service_worker_micro_benchmark_000.wpr": [
"http://localhost:8091/index.html",
"http://localhost:8091/many-registration.html"
]
}
}
\ No newline at end of file
1ca795d9e04b6bbf00fb7f881b699bdb0b369fc7
\ No newline at end of file
......@@ -9,39 +9,16 @@ from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker.json'
class ServiceWorkerBenchmarkPage(page.Page):
"""Page for workload to measure some specific functions in JS"""
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
action_runner.WaitForJavaScriptCondition('window.done')
class ServiceWorkerPageSet(page_set.PageSet):
"""Page set which is using ServiceWorker"""
"""Page set of applications using ServiceWorker"""
def __init__(self):
super(ServiceWorkerPageSet, self).__init__(
archive_data_file=archive_data_file_path,
make_javascript_deterministic=False,
bucket=page_set.PUBLIC_BUCKET)
bucket=page_set.PARTNER_BUCKET)
# pylint: disable=C0301
# The code of localhost:8091 is placed in
# https://github.com/coonsta/Service-Worker-Performance
# but currently the following is used:
# https://github.com/amiq11/Service-Worker-Performance/tree/follow_spec_and_many_registration
# (rev: 3238098ea0225f53dab2f69f7406db8a2712dbf9)
# This will be merged into the main repository.
# pylint: enable=C0301
# Why: to measure performance of many concurrent fetches
self.AddPage(ServiceWorkerBenchmarkPage(
'http://localhost:8091/index.html', self))
# Why: to measure performance of registrations
self.AddPage(ServiceWorkerBenchmarkPage(
'http://localhost:8091/many-registration.html', self))
# Why: the first application using ServiceWorker
# TODO(shimazu): Separate application tests from microbenchmark above two.
# 1st time: registration
self.AddPage(page.Page(
'https://jakearchibald.github.io/trained-to-thrill/', self))
......
# Copyright 2014 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 telemetry.page import page as page
from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker_micro_benchmark.json'
class ServiceWorkerBenchmarkPage(page.Page):
"""Page for workload to measure some specific functions in JS"""
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
action_runner.WaitForJavaScriptCondition('window.done')
class ServiceWorkerMicroBenchmarkPageSet(page_set.PageSet):
"""Page set for micro benchmarking of each functions with ServiceWorker"""
def __init__(self):
super(ServiceWorkerMicroBenchmarkPageSet, self).__init__(
archive_data_file=archive_data_file_path,
make_javascript_deterministic=False,
bucket=page_set.PUBLIC_BUCKET)
# pylint: disable=C0301
# The code of localhost:8091 is placed in
# https://github.com/coonsta/Service-Worker-Performance
# but currently the following is used:
# https://github.com/amiq11/Service-Worker-Performance/tree/follow_spec_and_many_registration
# (rev: 3238098ea0225f53dab2f69f7406db8a2712dbf9)
# This will be merged into the main repository.
# pylint: enable=C0301
# Why: to measure performance of many concurrent fetches
self.AddPage(ServiceWorkerBenchmarkPage(
'http://localhost:8091/index.html', self))
# Why: to measure performance of registrations
self.AddPage(ServiceWorkerBenchmarkPage(
'http://localhost:8091/many-registration.html', 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