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.
8 from telemetry
.core
import util
9 from telemetry
.page
import page_benchmark
12 class SunSpiderBenchark(page_benchmark
.PageBenchmark
):
13 def MeasurePage(self
, _
, tab
, results
):
15 window.location.pathname.indexOf('sunspider-results') >= 0"""
17 return tab
.EvaluateJavaScript(js_is_done
)
18 util
.WaitFor(_IsDone
, 300, poll_interval
=5)
20 js_get_results
= 'JSON.stringify(output);'
21 js_results
= json
.loads(tab
.EvaluateJavaScript(js_get_results
))
22 r
= collections
.defaultdict(list)
24 # js_results is: [{'foo': v1, 'bar': v2},
25 # {'foo': v3, 'bar': v4},
27 for result
in js_results
:
29 for key
, value
in result
.iteritems():
33 for key
, values
in r
.iteritems():
34 results
.Add(key
, 'ms', values
, data_type
='unimportant')
35 results
.Add('Total', 'ms', totals
)