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

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

Issue 2196873002: CC serialization perftests: more accurate "num runs in 2 seconds". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ReadMessage(&msg, &compositor_frame); 53 ReadMessage(&msg, &compositor_frame);
54 } 54 }
55 55
56 base::TimeTicks start = base::TimeTicks::Now(); 56 base::TimeTicks start = base::TimeTicks::Now();
57 base::TimeTicks end = 57 base::TimeTicks end =
58 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 58 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
59 base::TimeDelta min_time; 59 base::TimeDelta min_time;
60 size_t count = 0; 60 size_t count = 0;
61 while (start < end) { 61 while (start < end) {
62 for (int i = 0; i < kTimeCheckInterval; ++i) { 62 for (int i = 0; i < kTimeCheckInterval; ++i) {
63 ++count; 63 base::TimeTicks now = base::TimeTicks::Now();
64 if (now < end)
65 ++count;
64 CompositorFrame compositor_frame; 66 CompositorFrame compositor_frame;
65 ReadMessage(&msg, &compositor_frame); 67 ReadMessage(&msg, &compositor_frame);
66 } 68 }
67 69
68 base::TimeTicks now = base::TimeTicks::Now(); 70 base::TimeTicks now = base::TimeTicks::Now();
69 if (now - start < min_time || min_time.is_zero()) 71 if (now - start < min_time || min_time.is_zero())
70 min_time = now - start; 72 min_time = now - start;
71 start = base::TimeTicks::Now(); 73 start = base::TimeTicks::Now();
72 } 74 }
73 75
(...skipping 12 matching lines...) Expand all
86 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); 88 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame);
87 } 89 }
88 90
89 base::TimeTicks start = base::TimeTicks::Now(); 91 base::TimeTicks start = base::TimeTicks::Now();
90 base::TimeTicks end = 92 base::TimeTicks end =
91 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 93 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
92 base::TimeDelta min_time; 94 base::TimeDelta min_time;
93 size_t count = 0; 95 size_t count = 0;
94 while (start < end) { 96 while (start < end) {
95 for (int i = 0; i < kTimeCheckInterval; ++i) { 97 for (int i = 0; i < kTimeCheckInterval; ++i) {
98 base::TimeTicks now = base::TimeTicks::Now();
99 if (now < end)
100 ++count;
96 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 101 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
97 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); 102 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame);
98 ++count;
99 } 103 }
100 104
101 base::TimeTicks now = base::TimeTicks::Now(); 105 base::TimeTicks now = base::TimeTicks::Now();
102 if (now - start < min_time || min_time.is_zero()) 106 if (now - start < min_time || min_time.is_zero())
103 min_time = now - start; 107 min_time = now - start;
104 start = base::TimeTicks::Now(); 108 start = base::TimeTicks::Now();
105 } 109 }
106 110
107 perf_test::PrintResult( 111 perf_test::PrintResult(
108 "ParamTraits serialization: min_frame_serialization_time", "", 112 "ParamTraits serialization: min_frame_serialization_time", "",
(...skipping 11 matching lines...) Expand all
120 CompositorFrame compositor_frame; 124 CompositorFrame compositor_frame;
121 mojom::CompositorFrame::Deserialize(data, &compositor_frame); 125 mojom::CompositorFrame::Deserialize(data, &compositor_frame);
122 } 126 }
123 127
124 base::TimeTicks start = base::TimeTicks::Now(); 128 base::TimeTicks start = base::TimeTicks::Now();
125 base::TimeTicks end = 129 base::TimeTicks end =
126 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 130 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
127 base::TimeDelta min_time; 131 base::TimeDelta min_time;
128 size_t count = 0; 132 size_t count = 0;
129 while (start < end) { 133 while (start < end) {
130 for (int i = 0; i < kTimeCheckInterval; ++i) { 134 for (int i = 0; i < kTimeCheckInterval; ++i) {
danakj 2016/07/29 22:04:56 Just decrease kTimeCheckInterval for those tests a
yzshen1 2016/07/29 22:12:12 Decreasing the number of kTimeCheckInterval may af
danakj 2016/07/29 22:14:02 Ah ok.
135 base::TimeTicks now = base::TimeTicks::Now();
136 if (now < end)
137 ++count;
danakj 2016/07/29 22:14:02 Can you do this at the bottom of the loop. And you
yzshen1 2016/07/31 06:57:17 Done.
131 CompositorFrame compositor_frame; 138 CompositorFrame compositor_frame;
132 mojom::CompositorFrame::Deserialize(data, &compositor_frame); 139 mojom::CompositorFrame::Deserialize(data, &compositor_frame);
133 ++count;
134 } 140 }
135 141
136 base::TimeTicks now = base::TimeTicks::Now(); 142 base::TimeTicks now = base::TimeTicks::Now();
137 if (now - start < min_time || min_time.is_zero()) 143 if (now - start < min_time || min_time.is_zero())
138 min_time = now - start; 144 min_time = now - start;
139 start = base::TimeTicks::Now(); 145 start = base::TimeTicks::Now();
140 } 146 }
141 147
142 perf_test::PrintResult( 148 perf_test::PrintResult(
143 "StructTraits deserialization min_frame_deserialization_time", "", 149 "StructTraits deserialization min_frame_deserialization_time", "",
(...skipping 11 matching lines...) Expand all
155 DCHECK_GT(data.size(), 0u); 161 DCHECK_GT(data.size(), 0u);
156 } 162 }
157 163
158 base::TimeTicks start = base::TimeTicks::Now(); 164 base::TimeTicks start = base::TimeTicks::Now();
159 base::TimeTicks end = 165 base::TimeTicks end =
160 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); 166 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
161 base::TimeDelta min_time; 167 base::TimeDelta min_time;
162 size_t count = 0; 168 size_t count = 0;
163 while (start < end) { 169 while (start < end) {
164 for (int i = 0; i < kTimeCheckInterval; ++i) { 170 for (int i = 0; i < kTimeCheckInterval; ++i) {
171 base::TimeTicks now = base::TimeTicks::Now();
172 if (now < end)
173 ++count;
165 mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame); 174 mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame);
166 DCHECK_GT(data.size(), 0u); 175 DCHECK_GT(data.size(), 0u);
167 ++count;
168 } 176 }
169 177
170 base::TimeTicks now = base::TimeTicks::Now(); 178 base::TimeTicks now = base::TimeTicks::Now();
171 if (now - start < min_time || min_time.is_zero()) 179 if (now - start < min_time || min_time.is_zero())
172 min_time = now - start; 180 min_time = now - start;
173 start = base::TimeTicks::Now(); 181 start = base::TimeTicks::Now();
174 } 182 }
175 183
176 perf_test::PrintResult( 184 perf_test::PrintResult(
177 "StructTraits serialization min_frame_serialization_time", "", 185 "StructTraits serialization min_frame_serialization_time", "",
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 UseSingleSharedQuadState::NO); 254 UseSingleSharedQuadState::NO);
247 } 255 }
248 256
249 TEST_F(CCSerializationPerfTest, DelegatedFrame_ManyRenderPasses_1000_100) { 257 TEST_F(CCSerializationPerfTest, DelegatedFrame_ManyRenderPasses_1000_100) {
250 RunCompositorFrameTest("DelegatedFrame_ManyRenderPasses_10000_100", 100, 1000, 258 RunCompositorFrameTest("DelegatedFrame_ManyRenderPasses_10000_100", 100, 1000,
251 UseSingleSharedQuadState::NO); 259 UseSingleSharedQuadState::NO);
252 } 260 }
253 261
254 } // namespace 262 } // namespace
255 } // namespace cc 263 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698