| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 """Dummy benchmarks for the bisect FYI integration tests. | 4 """Dummy benchmarks for the bisect FYI integration tests. |
| 5 | 5 |
| 6 The number they produce aren't meant to represent any actual performance | 6 The number they produce aren't meant to represent any actual performance |
| 7 data of the browser. For more information about these dummy benchmarks, | 7 data of the browser. For more information about these dummy benchmarks, |
| 8 see: https://goo.gl/WvZiiW | 8 see: https://goo.gl/WvZiiW |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import random | 11 import random |
| 12 | 12 |
| 13 from core import perf_benchmark | 13 from core import perf_benchmark |
| 14 | 14 |
| 15 from telemetry.value import scalar | 15 from telemetry.value import scalar |
| 16 from telemetry.page import page_test | 16 from telemetry.page import page_test |
| 17 | 17 |
| 18 from page_sets import dummy_story_set | 18 from page_sets import dummy_story_set |
| 19 | 19 |
| 20 | 20 |
| 21 class _DummyTest(page_test.PageTest): | 21 class _DummyTest(page_test.PageTest): |
| 22 | 22 |
| 23 def __init__(self, avg, std): | 23 def __init__(self, avg, std): |
| 24 super(_DummyTest, self).__init__() | 24 super(_DummyTest, self).__init__() |
| 25 self._avg = avg | 25 self._avg = avg |
| 26 self._std = std | 26 self._std = std |
| 27 | 27 |
| 28 def ValidateAndMeasurePage(self, page, tab, results): | 28 def ValidateAndMeasurePage(self, page, tab, results): |
| 29 del tab # unused |
| 29 results.AddValue(scalar.ScalarValue( | 30 results.AddValue(scalar.ScalarValue( |
| 30 page=page, | 31 page=page, |
| 31 name='gaussian-value', units='ms', | 32 name='gaussian-value', units='ms', |
| 32 value=random.gauss(self._avg, self._std), | 33 value=random.gauss(self._avg, self._std), |
| 33 description=('Random number that follows the Gaussian distribution ' | 34 description=('Random number that follows the Gaussian distribution ' |
| 34 'with mean=%s and std=%s' % (self._avg, self._std)))) | 35 'with mean=%s and std=%s' % (self._avg, self._std)))) |
| 35 | 36 |
| 36 | 37 |
| 37 class _DummyBenchmark(perf_benchmark.PerfBenchmark): | 38 class _DummyBenchmark(perf_benchmark.PerfBenchmark): |
| 38 page_set = dummy_story_set.DummyStorySet | 39 page_set = dummy_story_set.DummyStorySet |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 class DummyBenchmarkTwo(_DummyBenchmark): | 53 class DummyBenchmarkTwo(_DummyBenchmark): |
| 53 """A noisy benchmark with mean=50 & std=20.""" | 54 """A noisy benchmark with mean=50 & std=20.""" |
| 54 | 55 |
| 55 def CreatePageTest(self, options): | 56 def CreatePageTest(self, options): |
| 56 return _DummyTest(50, 20) | 57 return _DummyTest(50, 20) |
| 57 | 58 |
| 58 @classmethod | 59 @classmethod |
| 59 def Name(cls): | 60 def Name(cls): |
| 60 return 'dummy_benchmark.noisy_benchmark_1' | 61 return 'dummy_benchmark.noisy_benchmark_1' |
| OLD | NEW |