https://bugs.webkit.org/show_bug.cgi?id=156827
PerformanceTests:
Reviewed by Stephanie Lewis.
Two new files for the content-animation suite.
After patching for use in the benchmark, these tests are a little different to other benchmarks.
The test content itself does not collect performance data; the tests spit out a boilerplate JSON
result with a placeholder for framerate, which is collected in native code.
When run as a benchmark, test completion involves a couple of bounces between the test and MobileSafari.
Test completion is initiated by a setTimeout() in the test, at which point location.hash is set to "#done".
MobileSafari detects that, and asynchronously dumps performance data. Once this is complete, MobileSafari
changes the URL has to "#submit", which triggers the XHR to the test relay that indicates the test is
complete.
* Animation/css-animation.html: Added.
* Animation/raf-animation.html: Added.
Tools:
rdar://problem/
24358135
Reviewed by Stephanie Lewis.
Enhance benchmark_runner so that a benchmark can load a set of tests sequentially,
and collate results across them. Also add the ability for the browser_driver to supply
additional results, allowing for tests that collect results data in native code, rather
than generating it in the web page.
Add a set of "content animation" tests that use this new functionality, which test
CSS animation and requestAnimationFrame performance.
'plan' files have two new optional keys:
'test_files': a list of files to run as a suite
'options': optional parameters. Currently supports one new option,
'animation_command', which affects the way that iOS tests are run,
and is passed to MobileSafari as a parameter on launch.
* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner.__init__): If options is not specified in the plan file, set it to an empty dictionary.
(BenchmarkRunner._get_result): Allow the browser_driver to modify the test results.
(BenchmarkRunner):
(BenchmarkRunner._run_one_test): Factored out of _run_benchmark, this contains logic for
running a single test. It starts and stops the http_server_driver.
(BenchmarkRunner._run_benchmark): Run a test in the traditional way if the plan has an 'entry_point'
key, otherwise look for the new 'test_files' and load each in a loop.
(BenchmarkRunner._dump):
* Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
(BrowserDriver.launch_url): Pass options.
(BrowserDriver.add_additional_results): Allow a driver to supply additional results.
(BrowserDriver):
* Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py:
(GTKMiniBrowserDriver.launch_url):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver.close_browsers):
(OSXBrowserDriver._terminate_processes): Fix spelling mistake.
(OSXBrowserDriver._terminiate_processes): Deleted.
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
(OSXChromeDriver.launch_url):
(OSXChromeCanaryDriver.launch_url):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
(OSXFirefoxDriver.launch_url):
(OSXFirefoxNightlyDriver.launch_url):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.launch_url):
* Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch: Added.
* Scripts/webkitpy/benchmark_runner/data/plans/content-animation.plan: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199805
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2016-04-20 Simon Fraser <simon.fraser@apple.com>
+
+ Add content animation tests to benchmark_runner, and allow the runner to collect device data as part of the results
+ https://bugs.webkit.org/show_bug.cgi?id=156827
+
+ Reviewed by Stephanie Lewis.
+
+ Two new files for the content-animation suite.
+
+ After patching for use in the benchmark, these tests are a little different to other benchmarks.
+ The test content itself does not collect performance data; the tests spit out a boilerplate JSON
+ result with a placeholder for framerate, which is collected in native code.
+
+ When run as a benchmark, test completion involves a couple of bounces between the test and MobileSafari.
+ Test completion is initiated by a setTimeout() in the test, at which point location.hash is set to "#done".
+ MobileSafari detects that, and asynchronously dumps performance data. Once this is complete, MobileSafari
+ changes the URL has to "#submit", which triggers the XHR to the test relay that indicates the test is
+ complete.
+
+ * Animation/css-animation.html: Added.
+ * Animation/raf-animation.html: Added.
+
2016-04-15 Jon Lee <jonlee@apple.com>
Animometer test could report a NaN
+2016-04-20 Simon Fraser <simon.fraser@apple.com>
+
+ Add content animation tests to benchmark_runner, and allow the runner to collect device data as part of the results
+ https://bugs.webkit.org/show_bug.cgi?id=156827
+ rdar://problem/24358135
+
+ Reviewed by Stephanie Lewis.
+
+ Enhance benchmark_runner so that a benchmark can load a set of tests sequentially,
+ and collate results across them. Also add the ability for the browser_driver to supply
+ additional results, allowing for tests that collect results data in native code, rather
+ than generating it in the web page.
+
+ Add a set of "content animation" tests that use this new functionality, which test
+ CSS animation and requestAnimationFrame performance.
+
+ 'plan' files have two new optional keys:
+ 'test_files': a list of files to run as a suite
+ 'options': optional parameters. Currently supports one new option,
+ 'animation_command', which affects the way that iOS tests are run,
+ and is passed to MobileSafari as a parameter on launch.
+
+ * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+ (BenchmarkRunner.__init__): If options is not specified in the plan file, set it to an empty dictionary.
+ (BenchmarkRunner._get_result): Allow the browser_driver to modify the test results.
+ (BenchmarkRunner):
+ (BenchmarkRunner._run_one_test): Factored out of _run_benchmark, this contains logic for
+ running a single test. It starts and stops the http_server_driver.
+ (BenchmarkRunner._run_benchmark): Run a test in the traditional way if the plan has an 'entry_point'
+ key, otherwise look for the new 'test_files' and load each in a loop.
+ (BenchmarkRunner._dump):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
+ (BrowserDriver.launch_url): Pass options.
+ (BrowserDriver.add_additional_results): Allow a driver to supply additional results.
+ (BrowserDriver):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py:
+ (GTKMiniBrowserDriver.launch_url):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+ (OSXBrowserDriver.close_browsers):
+ (OSXBrowserDriver._terminate_processes): Fix spelling mistake.
+ (OSXBrowserDriver._terminiate_processes): Deleted.
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
+ (OSXChromeDriver.launch_url):
+ (OSXChromeCanaryDriver.launch_url):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
+ (OSXFirefoxDriver.launch_url):
+ (OSXFirefoxNightlyDriver.launch_url):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+ (OSXSafariDriver.launch_url):
+ * Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch: Added.
+ * Scripts/webkitpy/benchmark_runner/data/plans/content-animation.plan: Added.
+
2016-04-20 Dustin Falgout <dustin@falgout.us>
[GTK] Expose AllowUniversalAccessFromFileURLs preference now that calling localStorage.getItem() results in SecurityError: DOM Exception 18
with open(plan_file, 'r') as fp:
self._plan_name = os.path.split(os.path.splitext(plan_file)[0])[1]
self._plan = json.load(fp)
+ if not 'options' in self._plan:
+ self._plan['options'] = {}
if local_copy:
self._plan['local_copy'] = local_copy
if count_override:
return absPath
return plan_file
+ def _get_result(self, test_url):
+ result = self._browser_driver.add_additional_results(test_url, self._http_server_driver.fetch_result())
+ assert(not self._http_server_driver.get_return_code())
+ return result
+
+ def _run_one_test(self, web_root, test_file):
+ result = None
+ try:
+ self._http_server_driver.serve(web_root)
+ url = urlparse.urljoin(self._http_server_driver.base_url(), self._plan_name + '/' + test_file)
+ self._browser_driver.launch_url(url, self._plan['options'], self._build_dir)
+ with timeout(self._plan['timeout']):
+ result = self._get_result(url)
+ finally:
+ self._browser_driver.close_browsers()
+ self._http_server_driver.kill_server()
+
+ return result
+
def _run_benchmark(self, count, web_root):
results = []
for iteration in xrange(1, count + 1):
_log.info('Start the iteration {current_iteration} of {iterations} for current benchmark'.format(current_iteration=iteration, iterations=count))
try:
- result = None
- self._http_server_driver.serve(web_root)
self._browser_driver.prepare_env(self._device_id)
- url = urlparse.urljoin(self._http_server_driver.base_url(), self._plan_name + '/' + self._plan['entry_point'])
- self._browser_driver.launch_url(url, self._build_dir)
- with timeout(self._plan['timeout']):
- result = self._http_server_driver.fetch_result()
- assert(not self._http_server_driver.get_return_code())
+
+ if 'entry_point' in self._plan:
+ result = self._run_one_test(web_root, self._plan['entry_point'])
assert(result)
results.append(json.loads(result))
+ elif 'test_files' in self._plan:
+ run_result = {}
+ for test in self._plan['test_files']:
+ result = self._run_one_test(web_root, test)
+ assert(result)
+ run_result = self._merge(run_result, json.loads(result))
+
+ results.append(run_result)
+ else:
+ raise Exception('Plan does not contain entry_point or test_files')
+
finally:
self._browser_driver.restore_env()
self._browser_driver.close_browsers()
- self._http_server_driver.kill_server()
+
_log.info('End the iteration {current_iteration} of {iterations} for current benchmark'.format(current_iteration=iteration, iterations=count))
+
results = self._wrap(results)
self._dump(results, self._output_file if self._output_file else self._plan['output_file'])
self.show_results(results, self._scale_unit)
@classmethod
def _dump(cls, results, output_file):
- _log.info('Dumping the results to file')
+ _log.info('Dumping the results to file {output_file}'.format(output_file=output_file))
try:
with open(output_file, 'w') as fp:
json.dump(results, fp)
pass
@abstractmethod
- def launch_url(self, url, browser_build_path=None):
+ def launch_url(self, url, options, browser_build_path=None):
pass
+ @abstractmethod
+ def add_additional_results(self, test_url, results):
+ return results
+
@abstractmethod
def close_browsers(self):
pass
self._minibrowser_process = None
super(GTKMiniBrowserDriver, self).prepare_env(device_id)
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
args = ['Tools/Scripts/run-minibrowser', '--gtk']
args.append("--geometry=%sx%s" % (self._screen_size().width, self._screen_size().height))
args.append(url)
pass
def close_browsers(self):
- self._terminiate_processes(self.process_name)
+ self._terminate_processes(self.process_name)
@classmethod
def _launch_process(cls, build_dir, app_name, url, args):
cls._launch_process_with_caffinate(args)
@classmethod
- def _terminiate_processes(cls, process_name):
- _log.info('Closing all terminating all processes with name %s' % process_name)
+ def _terminate_processes(cls, process_name):
+ _log.info('Closing all processes with name %s' % process_name)
subprocess.call(['/usr/bin/killall', process_name])
@classmethod
process_name = 'Google Chrome'
browser_name = 'chrome'
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
self._launch_process(build_dir=browser_build_path, app_name='Google Chrome.app', url=url, args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self._screen_size().width), height=int(self._screen_size().height))])
process_name = 'Google Chrome Canary'
browser_name = 'chrome-canary'
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
self._launch_process(build_dir=browser_build_path, app_name='Google Chrome Canary.app', url=url, args=['--args', '--homepage', url, '--window-size={width},{height}'.format(width=int(self._screen_size().width), height=int(self._screen_size().height))])
process_name = 'firefox'
browser_name = 'firefox'
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
self._launch_process(build_dir=browser_build_path, app_name='Firefox.app', url=url, args=[url, '--args', '-width', str(int(self._screen_size().width)), '-height', str(int(self._screen_size().height))])
process_name = 'firefox'
browser_name = 'firefox-nightly'
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
self._launch_process(build_dir=browser_build_path, app_name='FirefoxNightly.app', url=url, args=[url, '--args', '-width', str(int(self._screen_size().width)), '-height', str(int(self._screen_size().height))])
self._maximize_window()
self._safari_preferences = ["-HomePage", "about:blank", "-WarnAboutFraudulentWebsites", "0", "-ExtensionsEnabled", "0", "-ShowStatusBar", "0", "-NewWindowBehavior", "1", "-NewTabBehavior", "1"]
- def launch_url(self, url, browser_build_path):
+ def launch_url(self, url, options, browser_build_path):
args = ['/Applications/Safari.app/Contents/MacOS/Safari']
env = {}
if browser_build_path:
--- /dev/null
+diff --git a/PerformanceTests/Animation/css-animation.html b/PerformanceTests/Animation/css-animation.html
+index adae19cb018ed1ca93fd6b4cda80002348482fc3..8f1e29933faa13586dbf97b7874024854fbf2147 100644
+--- a/PerformanceTests/Animation/css-animation.html
++++ b/PerformanceTests/Animation/css-animation.html
+@@ -167,9 +167,54 @@
+ function setupAnimation()
+ {
+ makeParticles();
++
++ window.setTimeout(function() {
++ location.hash = 'done';
++ }, 10000)
++ }
++
++ function hashChanged()
++ {
++ if (location.hash === '#submit')
++ submitResults();
++ }
++
++ function submitResults()
++ {
++ var results = {
++ 'content-animation' : {
++ 'metrics' : {
++ 'FrameRate' : ['Arithmetic']
++ },
++ 'tests' : {
++ 'css-animation' : {
++ 'metrics' : {
++ 'FrameRate' : {
++ 'current' : ['<native_framerate>'] // <native_framerate> is replaced by a framerate computed in native code
++ }
++ }
++ }
++ }
++ }
++ };
++ var resultsString = JSON.stringify(results);
++ var xhr = new XMLHttpRequest();
++ xhr.open("POST", "/report");
++ xhr.setRequestHeader("Content-type", "application/json");
++ xhr.setRequestHeader("Content-length", resultsString.length);
++ xhr.setRequestHeader("Connection", "close");
++ xhr.onreadystatechange = function() {
++ if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++ closeRequest = new XMLHttpRequest();
++ closeRequest.open("GET", "/shutdown");
++ closeRequest.send()
++ }
++ }
++ xhr.send(resultsString);
+ }
+
+ window.addEventListener('load', setupAnimation, false);
++ window.addEventListener("hashchange", hashChanged, false);
+ </script>
+ </head>
+ <body>
+diff --git a/PerformanceTests/Animation/raf-animation.html b/PerformanceTests/Animation/raf-animation.html
+index cb11bc1e7412050c132564e1f2dea9f8729871a6..dbf18e72de9880c28d9fbf9fa156b4949bb6a6cf 100644
+--- a/PerformanceTests/Animation/raf-animation.html
++++ b/PerformanceTests/Animation/raf-animation.html
+@@ -195,9 +195,54 @@
+ {
+ makeParticles();
+ animate();
++
++ window.setTimeout(function() {
++ location.hash = 'done';
++ }, 10000)
++ }
++
++ function hashChanged()
++ {
++ if (location.hash === '#submit')
++ submitResults();
+ }
+
++ function submitResults()
++ {
++ var results = {
++ 'content-animation' : {
++ 'metrics' : {
++ 'FrameRate' : ['Arithmetic']
++ },
++ 'tests' : {
++ 'raf-animation' : {
++ 'metrics' : {
++ 'FrameRate' : {
++ 'current' : ['<native_framerate>'] // <native_framerate> is replaced by a framerate computed in native code
++ }
++ }
++ }
++ }
++ }
++ };
++ var resultsString = JSON.stringify(results);
++ var xhr = new XMLHttpRequest();
++ xhr.open("POST", "/report");
++ xhr.setRequestHeader("Content-type", "application/json");
++ xhr.setRequestHeader("Content-length", resultsString.length);
++ xhr.setRequestHeader("Connection", "close");
++ xhr.onreadystatechange = function() {
++ if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++ closeRequest = new XMLHttpRequest();
++ closeRequest.open("GET", "/shutdown");
++ closeRequest.send()
++ }
++ }
++ xhr.send(resultsString);
++ }
++
+ window.addEventListener('load', setupAnimation, false);
++ window.addEventListener("hashchange", hashChanged, false);
+ </script>
+ </head>
+ <body>
--- /dev/null
+{
+ "timeout": 120,
+ "count": 5,
+ "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/Animometer/@r<TBD>",
+ "test_files": [
+ "css-animation.html",
+ "raf-animation.html"
+ ],
+ "output_file": "css-animation.result",
+ "options": {
+ "animation_command": "ContentAnimation"
+ }
+}