OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 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. |
| 4 """ |
| 5 Benchmarks in this file is created for the purpose of testing telemetry |
| 6 integration with perf dashboard and bisect bot. The number they produce aren't |
| 7 meant to represent any actual performance data of the browser. |
| 8 """ |
| 9 |
| 10 import random |
| 11 |
| 12 from core import perf_benchmark |
| 13 |
| 14 from telemetry.value import scalar |
| 15 from telemetry.page import page_test |
| 16 |
| 17 import page_sets |
| 18 |
| 19 |
| 20 class _DummyTest(page_test.PageTest): |
| 21 def __init__(self, avg, std): |
| 22 super(_DummyTest, self).__init__() |
| 23 self._avg = avg |
| 24 self._std = std |
| 25 |
| 26 def ValidateAndMeasurePage(self, page, tab, results): |
| 27 results.AddValue(scalar.ScalarValue( |
| 28 page=page, |
| 29 name='gaussian-value', units='ms', |
| 30 value=random.gauss(self._avg, self._std), |
| 31 description=('Random number that follows the Gaussian distribution ' |
| 32 'with mean=%s and std=%s' % (self._avg, self._std)))) |
| 33 |
| 34 |
| 35 class _DummyBenchmark(perf_benchmark.PerfBenchmark): |
| 36 page_set = page_sets.DummyStorySet |
| 37 |
| 38 |
| 39 class DummyBenchmarkOne(_DummyBenchmark): |
| 40 """ A low noise benchmark with mean=100 & std=1. """ |
| 41 |
| 42 def CreatePageTest(self, options): |
| 43 return _DummyTest(100, 1) |
| 44 |
| 45 @classmethod |
| 46 def Name(cls): |
| 47 return 'dummy_benchmark.stable_benchmark_1' |
| 48 |
| 49 |
| 50 class DummyBenchmarkTwo(_DummyBenchmark): |
| 51 """ A noisy benchmark with mean=50 & std=20. """ |
| 52 |
| 53 def CreatePageTest(self, options): |
| 54 return _DummyTest(50, 20) |
| 55 |
| 56 @classmethod |
| 57 def Name(cls): |
| 58 return 'dummy_benchmark.noisy_benchmark_1' |
OLD | NEW |