1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from telemetry
.core
import util
6 from telemetry
.page
import page_benchmark
9 return float(sum(l
)) / len(l
) if len(l
) > 0 else 0.0
11 class Kraken(page_benchmark
.PageBenchmark
):
12 def MeasurePage(self
, _
, tab
, results
):
14 document.title.indexOf("Results") != -1 && document.readyState == "complete"
17 return bool(tab
.EvaluateJavaScript(js_is_done
))
18 util
.WaitFor(_IsDone
, 500, poll_interval
=5)
21 var formElement = document.getElementsByTagName("input")[0];
22 decodeURIComponent(formElement.value.split("?")[1]);
24 result_dict
= eval(tab
.EvaluateJavaScript(js_get_results
))
26 for key
in result_dict
:
29 results
.Add(key
, 'ms', result_dict
[key
], data_type
='unimportant')
30 total
+= _Mean(result_dict
[key
])
31 results
.Add('Total', 'ms', total
)