OLD | NEW |
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 "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
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/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace { | 22 namespace { |
23 | 23 |
24 static const int kTimeLimitMillis = 2000; | 24 static const int kTimeLimitMillis = 2000; |
25 static const int kNumWarmupRuns = 20; | 25 static const int kNumWarmupRuns = 20; |
26 static const int kTimeCheckInterval = 10; | 26 static const int kTimeCheckInterval = 10; |
27 | 27 |
28 class CCMessagesPerfTest : public testing::Test { | 28 class CCMessagesPerfTest : public testing::Test { |
29 protected: | 29 protected: |
30 static void RunTest(std::string test_name, const CompositorFrame& frame) { | 30 static void RunTest(std::string test_name, const CompositorFrame& frame) { |
31 for (int i = 0; i < kNumWarmupRuns; ++i) { | 31 for (int i = 0; i < kNumWarmupRuns; ++i) { |
32 IPC::Message msg(1, 2); | 32 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
33 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); | 33 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); |
34 } | 34 } |
35 | 35 |
36 base::TimeTicks start = base::TimeTicks::HighResNow(); | 36 base::TimeTicks start = base::TimeTicks::HighResNow(); |
37 base::TimeTicks end = | 37 base::TimeTicks end = |
38 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); | 38 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); |
39 base::TimeDelta min_time; | 39 base::TimeDelta min_time; |
40 int count = 0; | 40 int count = 0; |
41 while (start < end) { | 41 while (start < end) { |
42 for (int i = 0; i < kTimeCheckInterval; ++i) { | 42 for (int i = 0; i < kTimeCheckInterval; ++i) { |
43 IPC::Message msg(1, 2); | 43 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
44 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); | 44 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); |
45 ++count; | 45 ++count; |
46 } | 46 } |
47 | 47 |
48 base::TimeTicks now = base::TimeTicks::HighResNow(); | 48 base::TimeTicks now = base::TimeTicks::HighResNow(); |
49 if (now - start < min_time || min_time == base::TimeDelta()) | 49 if (now - start < min_time || min_time == base::TimeDelta()) |
50 min_time = now - start; | 50 min_time = now - start; |
51 start = base::TimeTicks::HighResNow(); | 51 start = base::TimeTicks::HighResNow(); |
52 } | 52 } |
53 | 53 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 render_pass->shared_quad_state_list.back(); | 148 render_pass->shared_quad_state_list.back(); |
149 } | 149 } |
150 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); | 150 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); |
151 } | 151 } |
152 | 152 |
153 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); | 153 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); |
154 } | 154 } |
155 | 155 |
156 } // namespace | 156 } // namespace |
157 } // namespace content | 157 } // namespace content |
OLD | NEW |