| 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 15 matching lines...) Expand all Loading... |
| 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, IPC::Message::PRIORITY_NORMAL); | 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::Now(); |
| 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, IPC::Message::PRIORITY_NORMAL); | 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::Now(); |
| 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::Now(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 perf_test::PrintResult( | 54 perf_test::PrintResult( |
| 55 "min_frame_serialization_time", | 55 "min_frame_serialization_time", |
| 56 "", | 56 "", |
| 57 test_name, | 57 test_name, |
| 58 min_time.InMillisecondsF() / kTimeCheckInterval * 1000, | 58 min_time.InMillisecondsF() / kTimeCheckInterval * 1000, |
| 59 "us", | 59 "us", |
| 60 true); | 60 true); |
| 61 } | 61 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 quad->shared_quad_state = render_pass->shared_quad_state_list.back(); | 143 quad->shared_quad_state = render_pass->shared_quad_state_list.back(); |
| 144 } | 144 } |
| 145 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); | 145 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); | 148 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |