blob: b62adf7990776c0a6c6cc4047f660735382e0fa0 [file] [log] [blame]
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
from page_sets import press_story
from telemetry import story
from telemetry.value import list_of_scalar_values
from telemetry.value import scalar
'This benchmark uses the [A* search algorithm]'
'(*_search_algorithm) to automatically '
'plot an efficient path between two points, in the presence of '
'obstacles. Adapted from code by [Brian Gringstead]'
'This benchmark performs [beat detection]'
'( on an Audio sample '
'using [code]('
'/beatdetektor/trunk/core/js/beatdetektor.js?revision=18&view=markup) '
'from [BeatDetektor]('
'?option=com_content&view=article&id=67&Itemid=82) and '
'This benchmark performs a [Discrete Fourier Transform]'
'( on an '
'Audio sample using code from [DSP.js]'
'This benchmark performs a [Fast Fourier Transform]'
'( on an Audio '
'sample using code from [DSP.js]'
'This benchmark generates a soundwave using code from [DSP.js]'
'This benchmark performs a variety of photo manipulations such as '
'Fill, Brightness, Contrast, Saturation, and Temperature.',
'This benchmark [desaturates]'
'( a photo using code from '
'This benchmark performs a [Gaussian blur]'
'( on a photo.',
'This benchmark parses [JSON]( records.',
'This benchmark serializes [Tinderbox]'
'( build '
'data to [JSON](',
def _Mean(l):
return float(sum(l)) / len(l) if len(l) > 0 else 0.0
class KrakenStory(press_story.PressStory):
def ExecuteTest(self, action_runner):
'document.title.indexOf("Results") != -1', timeout=700)
def ParseTestResults(self, action_runner):
result_dict = json.loads(action_runner.EvaluateJavaScript("""
var formElement = document.getElementsByTagName("input")[0];
total = 0
for key in result_dict:
if key == 'v':
self, key, 'ms', result_dict[key], important=False,
total += _Mean(result_dict[key])
# TODO(tonyg/nednguyen): This measurement shouldn't calculate Total. The
# results system should do that for us.
self, 'Total', 'ms', total,
description='Total of the means of the results for each type '
'of benchmark in [Mozilla\'s Kraken JavaScript benchmark]'
class KrakenStorySet(story.StorySet):
def __init__(self):
super(KrakenStorySet, self).__init__(