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

Side by Side Diff: cc/ipc/cc_serialization_perftest.cc

Issue 2604953003: Remove internal uses of mojo::Array and mojo::WTFArray. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include <utility> 5 #include <utility>
6 6
7 #include "base/test/launcher/unit_test_launcher.h" 7 #include "base/test/launcher/unit_test_launcher.h"
8 #include "base/test/test_suite.h" 8 #include "base/test/test_suite.h"
9 #include "cc/ipc/cc_param_traits.h" 9 #include "cc/ipc/cc_param_traits.h"
10 #include "cc/ipc/compositor_frame.mojom.h" 10 #include "cc/ipc/compositor_frame.mojom.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 perf_test::PrintResult( 113 perf_test::PrintResult(
114 "ParamTraits serialization: min_frame_serialization_time", "", 114 "ParamTraits serialization: min_frame_serialization_time", "",
115 test_name, min_time.InMillisecondsF() / kTimeCheckInterval * 1000, "us", 115 test_name, min_time.InMillisecondsF() / kTimeCheckInterval * 1000, "us",
116 true); 116 true);
117 perf_test::PrintResult("ParamTraits serialization: num runs in 2 seconds", 117 perf_test::PrintResult("ParamTraits serialization: num runs in 2 seconds",
118 "", test_name, count, "", true); 118 "", test_name, count, "", true);
119 } 119 }
120 120
121 static void RunDeserializationTestStructTraits(const std::string& test_name, 121 static void RunDeserializationTestStructTraits(const std::string& test_name,
122 const CompositorFrame& frame) { 122 const CompositorFrame& frame) {
123 mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame); 123 auto data = mojom::CompositorFrame::Serialize(&frame);
124 DCHECK_GT(data.size(), 0u); 124 DCHECK_GT(data.size(), 0u);
125 for (int i = 0; i < kNumWarmupRuns; ++i) { 125 for (int i = 0; i < kNumWarmupRuns; ++i) {
126 CompositorFrame compositor_frame; 126 CompositorFrame compositor_frame;
127 mojom::CompositorFrame::Deserialize(data, &compositor_frame); 127 mojom::CompositorFrame::Deserialize(data, &compositor_frame);
128 } 128 }
129 129
130 base::TimeTicks start = base::TimeTicks::Now(); 130 base::TimeTicks start = base::TimeTicks::Now();
131 base::TimeTicks end = 131 base::TimeTicks end =
132 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 132 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
133 base::TimeTicks now = start; 133 base::TimeTicks now = start;
(...skipping 19 matching lines...) Expand all
153 test_name, min_time.InMillisecondsF() / kTimeCheckInterval * 1000, "us", 153 test_name, min_time.InMillisecondsF() / kTimeCheckInterval * 1000, "us",
154 true); 154 true);
155 perf_test::PrintResult( 155 perf_test::PrintResult(
156 "StructTraits deserialization: num runs in 2 seconds", "", test_name, 156 "StructTraits deserialization: num runs in 2 seconds", "", test_name,
157 count, "", true); 157 count, "", true);
158 } 158 }
159 159
160 static void RunSerializationTestStructTraits(const std::string& test_name, 160 static void RunSerializationTestStructTraits(const std::string& test_name,
161 const CompositorFrame& frame) { 161 const CompositorFrame& frame) {
162 for (int i = 0; i < kNumWarmupRuns; ++i) { 162 for (int i = 0; i < kNumWarmupRuns; ++i) {
163 mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame); 163 auto data = mojom::CompositorFrame::Serialize(&frame);
164 DCHECK_GT(data.size(), 0u); 164 DCHECK_GT(data.size(), 0u);
165 } 165 }
166 166
167 base::TimeTicks start = base::TimeTicks::Now(); 167 base::TimeTicks start = base::TimeTicks::Now();
168 base::TimeTicks end = 168 base::TimeTicks end =
169 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 169 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
170 base::TimeTicks now = start; 170 base::TimeTicks now = start;
171 base::TimeDelta min_time; 171 base::TimeDelta min_time;
172 size_t count = 0; 172 size_t count = 0;
173 while (start < end) { 173 while (start < end) {
174 for (int i = 0; i < kTimeCheckInterval; ++i) { 174 for (int i = 0; i < kTimeCheckInterval; ++i) {
175 mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame); 175 auto data = mojom::CompositorFrame::Serialize(&frame);
176 DCHECK_GT(data.size(), 0u); 176 DCHECK_GT(data.size(), 0u);
177 now = base::TimeTicks::Now(); 177 now = base::TimeTicks::Now();
178 // We don't count iterations after the end time. 178 // We don't count iterations after the end time.
179 if (now < end) 179 if (now < end)
180 ++count; 180 ++count;
181 } 181 }
182 182
183 if (now - start < min_time || min_time.is_zero()) 183 if (now - start < min_time || min_time.is_zero())
184 min_time = now - start; 184 min_time = now - start;
185 start = now; 185 start = now;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 UseSingleSharedQuadState::NO); 255 UseSingleSharedQuadState::NO);
256 } 256 }
257 257
258 TEST_F(CCSerializationPerfTest, DelegatedFrame_ManyRenderPasses_1000_100) { 258 TEST_F(CCSerializationPerfTest, DelegatedFrame_ManyRenderPasses_1000_100) {
259 RunCompositorFrameTest("DelegatedFrame_ManyRenderPasses_10000_100", 100, 1000, 259 RunCompositorFrameTest("DelegatedFrame_ManyRenderPasses_10000_100", 100, 1000,
260 UseSingleSharedQuadState::NO); 260 UseSingleSharedQuadState::NO);
261 } 261 }
262 262
263 } // namespace 263 } // namespace
264 } // namespace cc 264 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/hash_util.h » ('j') | mojo/public/cpp/bindings/lib/hash_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698