This is a script for automating the browser based benchmarks(e.g. Speedometer, JetStream)
benchmark_runner ├── README.md ├── __init__.py ├── benchmark_builder.py ├── benchmark_results.py ├── benchmark_results_unittest.py ├── benchmark_runner.py ├── browser_driver │ ├── __init__.py │ ├── browser_driver.py │ ├── browser_driver_factory.py │ ├── osx_browser_driver.py │ ├── osx_chrome_driver.py │ ├── osx_firefox_driver.py │ └── osx_safari_driver.py ├── data │ ├── patches │ │ ├── Dromaeo.patch │ │ ├── JSBench.patch │ │ ├── JetStream.patch │ │ ├── Kraken.patch │ │ ├── Octane.patch │ │ ├── Speedometer.patch │ │ └── SunSpider.patch │ └── plans │ ├── dromaeo-cssquery.plan │ ├── dromaeo-dom.plan │ ├── dromaeo-jslib.plan │ ├── jetstream.plan │ ├── jsbench.plan │ ├── kraken.plan │ ├── octane.plan │ ├── speedometer.plan │ └── sunspider.plan ├── generic_factory.py ├── http_server_driver │ ├── __init__.py │ ├── http_server │ │ └── twisted_http_server.py │ ├── http_server_driver.py │ ├── http_server_driver_factory.py │ └── simple_http_server_driver.py ├── run_benchmark.py └── utils.py
python path/to/run-benchmark --build-directory path/to/browser/directory --plan json_format_plan --platform target_platform --browser target_browser
To create a plan, you may refer to Plans/jetstream.plan.
{ "timeout" : 600, "count": 5, "local_copy": "../../../../PerformanceTests/JetStream", "benchmark_patch": "data/patches/JetStream.patch", "entry_point": "JetStream/JetStream-1.0.1/index.html", "config": { "orientation": "portrait" }, "output_file": "jetstream.result" }
Plan is a json-formatted dictionary which contains following keys
var xhr = new XMLHttpRequest(); xhr.open("POST", "/report"); xhr.setRequestHeader("Content-type", "application/json"); xhr.setRequestHeader("Content-length", results.length); xhr.setRequestHeader("Connection", "close"); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { var closeRequest = new XMLHttpRequest(); closeRequest.open("GET", '/shutdown'); closeRequest.send() } } xhr.send(results);
* Create a patch file against original file * Go to the directory contains the benchmark directory (e.g. for JetStream, you should go to PerformaceTest folder) * Use ```git diff --relative HEAD > your.patch``` to create your patch * (**Suggested**) move the patch to the 'Patches' directory under project directory * Create a plan for the benchmark (refer to **"How to create a plan"** for more details) * Do following instruction **ONLY IF NEEDED**. In most case, you do not have to. * If you want to customize BrowserDriver for specific browser/platform, you need to extend browser_driver/browser_driver.py and register your module in browser_driver/browser_driversjson. * If you want to customize HTTPServerDriver, you need to extend http_server_drirver/http_server_driver and register your module in http_server_driver/http_server_drivers.json.