| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 | 4 |
| 5 import page_sets | 5 import page_sets |
| 6 | 6 |
| 7 from core import perf_benchmark | 7 from core import perf_benchmark |
| 8 from telemetry import benchmark | 8 from telemetry import benchmark |
| 9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
| 10 from telemetry.value import scalar | 10 from telemetry.value import scalar |
| 11 from telemetry.value import improvement_direction | 11 from telemetry.value import improvement_direction |
| 12 from telemetry.timeline import tracing_category_filter |
| 13 from telemetry.web_perf import timeline_based_measurement |
| 14 from telemetry.web_perf.metrics import v8_gc_latency |
| 15 from telemetry.web_perf.metrics import smoothness |
| 16 from telemetry.web_perf.metrics import memory_timeline |
| 17 |
| 12 | 18 |
| 13 class _OortOnlineMeasurement(page_test.PageTest): | 19 class _OortOnlineMeasurement(page_test.PageTest): |
| 14 def __init__(self): | 20 def __init__(self): |
| 15 super(_OortOnlineMeasurement, self).__init__() | 21 super(_OortOnlineMeasurement, self).__init__() |
| 16 | 22 |
| 17 def ValidateAndMeasurePage(self, page, tab, results): | 23 def ValidateAndMeasurePage(self, page, tab, results): |
| 18 tab.WaitForJavaScriptExpression('window.benchmarkFinished', 1000) | 24 tab.WaitForJavaScriptExpression('window.benchmarkFinished', 1000) |
| 19 scores = tab.EvaluateJavaScript('window.benchmarkScore') | 25 scores = tab.EvaluateJavaScript('window.benchmarkScore') |
| 20 for score in scores: | 26 for score in scores: |
| 21 valid = score['valid'] | 27 valid = score['valid'] |
| 22 if valid: | 28 if valid: |
| 23 results.AddValue(scalar.ScalarValue( | 29 results.AddValue(scalar.ScalarValue( |
| 24 results.current_page, score['name'], 'score', score['score'], | 30 results.current_page, score['name'], 'score', score['score'], |
| 25 important=True, improvement_direction=improvement_direction.UP)) | 31 important=True, improvement_direction=improvement_direction.UP)) |
| 26 | 32 |
| 27 @benchmark.Disabled('android') | 33 @benchmark.Disabled('android') |
| 28 class OortOnline(perf_benchmark.PerfBenchmark): | 34 class OortOnline(perf_benchmark.PerfBenchmark): |
| 29 """OortOnline benchmark that measures WebGL and V8 performance. | 35 """OortOnline benchmark that measures WebGL and V8 performance. |
| 30 URL: http://oortonline.gl/#run | 36 URL: http://oortonline.gl/#run |
| 31 Info: http://v8project.blogspot.de/2015/10/jank-busters-part-one.html | 37 Info: http://v8project.blogspot.de/2015/10/jank-busters-part-one.html |
| 32 """ | 38 """ |
| 33 test = _OortOnlineMeasurement | 39 test = _OortOnlineMeasurement |
| 34 | 40 |
| 35 @classmethod | 41 @classmethod |
| 36 def Name(cls): | 42 def Name(cls): |
| 37 return 'oortonline' | 43 return 'oortonline' |
| 38 | 44 |
| 39 def CreateStorySet(self, options): | 45 def CreateStorySet(self, options): |
| 40 return page_sets.OortOnlinePageSet() | 46 return page_sets.OortOnlinePageSet() |
| 47 |
| 48 |
| 49 # Disabled on reference builds because they don't support the new |
| 50 # Tracing.requestMemoryDump DevTools API. See http://crbug.com/540022. |
| 51 @benchmark.Disabled('reference') |
| 52 @benchmark.Disabled('android') |
| 53 class OortOnlineTBM(perf_benchmark.PerfBenchmark): |
| 54 """OortOnline benchmark that measures WebGL and V8 performance. |
| 55 URL: http://oortonline.gl/#run |
| 56 Info: http://v8project.blogspot.de/2015/10/jank-busters-part-one.html |
| 57 """ |
| 58 |
| 59 def SetExtraBrowserOptions(self, options): |
| 60 options.AppendExtraBrowserArgs([ |
| 61 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 62 # See: http://crbug.com/513692 |
| 63 '--enable-memory-benchmarking', |
| 64 # TODO(ssid): Remove this flag after fixing http://crbug.com/461788. |
| 65 '--no-sandbox' |
| 66 ]) |
| 67 |
| 68 def CreateStorySet(self, options): |
| 69 return page_sets.OortOnlineTBMPageSet() |
| 70 |
| 71 def CreateTimelineBasedMeasurementOptions(self): |
| 72 v8_gc_latency_categories = [ |
| 73 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 74 smoothness_categories = [ |
| 75 'webkit.console', 'blink.console', 'benchmark', 'trace_event_overhead'] |
| 76 categories = list(set(v8_gc_latency_categories + smoothness_categories)) |
| 77 memory_categories = 'blink.console,disabled-by-default-memory-infra' |
| 78 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 79 memory_categories) |
| 80 for category in categories: |
| 81 category_filter.AddIncludedCategory(category) |
| 82 options = timeline_based_measurement.Options(category_filter) |
| 83 options.SetTimelineBasedMetrics([v8_gc_latency.V8GCLatency(), |
| 84 smoothness.SmoothnessMetric(), |
| 85 memory_timeline.MemoryTimelineMetric()]) |
| 86 return options |
| 87 |
| 88 @classmethod |
| 89 def Name(cls): |
| 90 return 'oortonline_tbm' |
| 91 |
| 92 @classmethod |
| 93 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 94 if value.tir_label in ['Begin', 'End']: |
| 95 return value.name.startswith('memory_') and 'v8_renderer' in value.name |
| 96 else: |
| 97 return value.tir_label == 'Running' |
| OLD | NEW |