Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: content/test/gpu/gpu_tests/memory.py

Issue 471763003: Remove deprecated methods related to tracing in browser.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/perf/measurements/image_decoding.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 import memory_expectations 4 import memory_expectations
5 import page_sets 5 import page_sets
6 6
7 from telemetry import benchmark 7 from telemetry import benchmark
8 from telemetry.page import page_test 8 from telemetry.page import page_test
9 from telemetry.core.platform import tracing_category_filter
10 from telemetry.core.platform import tracing_options
9 from telemetry.timeline import counter 11 from telemetry.timeline import counter
10 from telemetry.timeline import model 12 from telemetry.timeline import model
11 13
12 MEMORY_LIMIT_MB = 192 14 MEMORY_LIMIT_MB = 192
13 SINGLE_TAB_LIMIT_MB = 192 15 SINGLE_TAB_LIMIT_MB = 192
14 WIGGLE_ROOM_MB = 12 16 WIGGLE_ROOM_MB = 12
15 17
16 test_harness_script = r""" 18 test_harness_script = r"""
17 var domAutomationController = {}; 19 var domAutomationController = {};
18 domAutomationController._finished = false; 20 domAutomationController._finished = false;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 59
58 window.domAutomationController = domAutomationController; 60 window.domAutomationController = domAutomationController;
59 61
60 window.addEventListener("load", function() { 62 window.addEventListener("load", function() {
61 useGpuMemory(%d); 63 useGpuMemory(%d);
62 }, false); 64 }, false);
63 """ % MEMORY_LIMIT_MB 65 """ % MEMORY_LIMIT_MB
64 66
65 class _MemoryValidator(page_test.PageTest): 67 class _MemoryValidator(page_test.PageTest):
66 def ValidateAndMeasurePage(self, page, tab, results): 68 def ValidateAndMeasurePage(self, page, tab, results):
67 timeline_data = tab.browser.StopTracing() 69 timeline_data = tab.browser.platform.tracing_controller.Stop()
68 timeline_model = model.TimelineModel(timeline_data) 70 timeline_model = model.TimelineModel(timeline_data)
69 for process in timeline_model.GetAllProcesses(): 71 for process in timeline_model.GetAllProcesses():
70 if 'gpu.GpuMemoryUsage' in process.counters: 72 if 'gpu.GpuMemoryUsage' in process.counters:
71 counter = process.GetCounter('gpu', 'GpuMemoryUsage') 73 counter = process.GetCounter('gpu', 'GpuMemoryUsage')
72 mb_used = counter.samples[-1] / 1048576 74 mb_used = counter.samples[-1] / 1048576
73 75
74 if mb_used + WIGGLE_ROOM_MB < SINGLE_TAB_LIMIT_MB: 76 if mb_used + WIGGLE_ROOM_MB < SINGLE_TAB_LIMIT_MB:
75 raise page_test.Failure(self._FormatException('low', mb_used)) 77 raise page_test.Failure(self._FormatException('low', mb_used))
76 78
77 if mb_used - WIGGLE_ROOM_MB > MEMORY_LIMIT_MB: 79 if mb_used - WIGGLE_ROOM_MB > MEMORY_LIMIT_MB:
78 raise page_test.Failure(self._FormatException('high', mb_used)) 80 raise page_test.Failure(self._FormatException('high', mb_used))
79 81
80 def CustomizeBrowserOptions(self, options): 82 def CustomizeBrowserOptions(self, options):
81 options.AppendExtraBrowserArgs('--enable-logging') 83 options.AppendExtraBrowserArgs('--enable-logging')
82 options.AppendExtraBrowserArgs( 84 options.AppendExtraBrowserArgs(
83 '--force-gpu-mem-available-mb=%s' % MEMORY_LIMIT_MB) 85 '--force-gpu-mem-available-mb=%s' % MEMORY_LIMIT_MB)
84 86
85 def WillNavigateToPage(self, page, tab): 87 def WillNavigateToPage(self, page, tab):
86 # FIXME: Remove webkit.console when blink.console lands in chromium and the 88 # FIXME: Remove webkit.console when blink.console lands in chromium and the
87 # ref builds are updated. crbug.com/386847 89 # ref builds are updated. crbug.com/386847
88 custom_categories = ['webkit.console', 'blink.console', 'gpu'] 90 custom_categories = ['webkit.console', 'blink.console', 'gpu']
89 tab.browser.StartTracing(','.join(custom_categories), 60) 91 category_filter = tracing_category_filter.TracingCategoryFilter()
92 for c in custom_categories:
93 category_filter.AddIncludedCategory(c)
94 options = tracing_options.TracingOptions()
95 options.enable_chrome_trace = True
96 tab.browser.platform.tracing_controller.Start(options, category_filter, 60)
90 97
91 def _FormatException(self, low_or_high, mb_used): 98 def _FormatException(self, low_or_high, mb_used):
92 return 'Memory allocation too %s (was %d MB, should be %d MB +/- %d MB)' % ( 99 return 'Memory allocation too %s (was %d MB, should be %d MB +/- %d MB)' % (
93 low_or_high, mb_used, SINGLE_TAB_LIMIT_MB, WIGGLE_ROOM_MB) 100 low_or_high, mb_used, SINGLE_TAB_LIMIT_MB, WIGGLE_ROOM_MB)
94 101
95 class Memory(benchmark.Benchmark): 102 class Memory(benchmark.Benchmark):
96 """Tests GPU memory limits""" 103 """Tests GPU memory limits"""
97 test = _MemoryValidator 104 test = _MemoryValidator
98 page_set = page_sets.MemoryTestsPageSet 105 page_set = page_sets.MemoryTestsPageSet
99 106
100 def CreateExpectations(self, page_set): 107 def CreateExpectations(self, page_set):
101 return memory_expectations.MemoryExpectations() 108 return memory_expectations.MemoryExpectations()
102 109
103 def CreatePageSet(self, options): 110 def CreatePageSet(self, options):
104 page_set = super(Memory, self).CreatePageSet(options) 111 page_set = super(Memory, self).CreatePageSet(options)
105 for page in page_set.pages: 112 for page in page_set.pages:
106 page.script_to_evaluate_on_commit = test_harness_script 113 page.script_to_evaluate_on_commit = test_harness_script
107 return page_set 114 return page_set
OLDNEW
« no previous file with comments | « no previous file | tools/perf/measurements/image_decoding.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698