Index: tools/perf/benchmarks/doyouevenbench.py |
diff --git a/tools/perf/benchmarks/doyouevenbench.py b/tools/perf/benchmarks/doyouevenbench.py |
index 08f535df72620532a397b5c632349e9a8ff4dec0..a4af53ad75f9a65c97d69f90eb8a1343620527c4 100644 |
--- a/tools/perf/benchmarks/doyouevenbench.py |
+++ b/tools/perf/benchmarks/doyouevenbench.py |
@@ -22,40 +22,41 @@ class DoYouEvenBenchMeasurement(page_measurement.PageMeasurement): |
def MeasurePage(self, _, tab, results): |
tab.WaitForDocumentReadyStateToBeComplete() |
- # Click Run button on http://rniwa.com/DoYouEvenBench to start test. |
- tab.ExecuteJavaScript('document.getElementsByTagName("button")[1].click();') |
- # <PRE> tag stores the results once the tests are completed. |
+ # Tests are ran 5 iteration, results are displayed in the form of HTML |
+ # table. Each row represents timetaken in that iteration and adds rows for |
+ # Arithmetic Mean and 95th Percentile. Total 7 rows in the results table. |
tab.WaitForJavaScriptExpression( |
- 'document.getElementsByTagName("pre").length > 0', 200) |
- # Parse results |
- results_log = tab.EvaluateJavaScript( |
- 'document.getElementsByTagName("pre")[0].innerHTML') |
- res_log = results_log.splitlines() |
- for res in res_log: |
- name_and_score = res.split(': ', 2) |
- assert len(name_and_score) == 2, 'Unexpected result format "%s"' % res |
- # Replace '/' with '_' for quantity being measure otherwise it asserts |
- # while printing results to stdout. |
- name = name_and_score[0].replace('/', '_').strip() |
- score = float(name_and_score[1].replace('ms', '').strip()) |
- # Since Total consists total time taken by all tests, add its values |
- # to Summary. |
- if 'Total' not in name: |
+ 'document.getElementsByTagName("tr").length >= 7', 200) |
+ # Parse results and result for each run including mean and 95th percentile. |
+ js_results = """ function JsResults() { |
+ var _result = {} |
+ _rows = document.getElementsByTagName("tr"); |
+ for(var i=0; i< _rows.length; i++) { |
+ if (_rows[i].cells[0].innerText.indexOf("95th Percentile") == -1) { |
+ _result[_rows[i].cells[0].innerText] = _rows[i].cells[1].innerText; |
+ } |
+ } |
+ return _result; |
+ }; JsResults();""" |
+ results_log = tab.EvaluateJavaScript(js_results) |
+ for name, value in results_log.iteritems(): |
+ score = float(value.replace('ms', '').strip()) |
+ # Add time taken for each iteration to run tests. |
+ if name != 'Arithmetic Mean': |
results.Add(name, 'ms', score, data_type='unimportant') |
else: |
- results.AddSummaryValue(scalar.ScalarValue(None, 'Total', 'ms', score)) |
- |
+ results.AddSummaryValue(scalar.ScalarValue(None, name, 'ms', score)) |
class DoYouEvenBench(test.Test): |
"""DoYouEvenBench benchmark related to DOMs using JS frameworks.""" |
test = DoYouEvenBenchMeasurement |
def CreatePageSet(self, options): |
- return page_set.PageSet.FromDict({ |
- 'archive_data_file': '../page_sets/data/doyouevenbench.json', |
- 'make_javascript_deterministic': False, |
- 'pages': [ |
- {'url': 'http://rniwa.com/DoYouEvenBench/'} |
- ] |
- }, os.path.abspath(__file__)) |
- |
+ ps = page_set.PageSet( |
+ file_path=os.path.abspath(__file__), |
+ archive_data_file='../page_sets/data/doyouevenbench.json', |
+ make_javascript_deterministic=False) |
+ ps.AddPageWithDefaultRunNavigate( |
+ 'https://trac.webkit.org/export/164157/trunk/' |
+ 'PerformanceTests/DoYouEvenBench/Full.html') |
+ return ps |