| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This file has perf tests for async waits using |mojo::RunLoop| (i.e., the | 5 // This file has perf tests for async waits using |mojo::RunLoop| (i.e., the |
| 6 // "standalone" |Environment|). | 6 // "standalone" |Environment|). |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include "gtest/gtest.h" |
| 10 #include "mojo/public/c/tests/environment/async_waiter_perftest_helpers.h" | 11 #include "mojo/public/c/tests/environment/async_waiter_perftest_helpers.h" |
| 11 #include "mojo/public/cpp/environment/environment.h" | 12 #include "mojo/public/cpp/environment/environment.h" |
| 12 #include "mojo/public/cpp/test_support/test_support.h" | 13 #include "mojo/public/cpp/test_support/test_support.h" |
| 13 #include "mojo/public/cpp/utility/run_loop.h" | 14 #include "mojo/public/cpp/utility/run_loop.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 constexpr MojoTimeTicks kPerftestTimeMicroseconds = 3 * 1000000; | 19 constexpr MojoTimeTicks kPerftestTimeMicroseconds = 3 * 1000000; |
| 20 | 20 |
| 21 TEST(RunLoopAsyncWaitPerftest, SingleThreaded) { | 21 TEST(RunLoopAsyncWaitPerftest, SingleThreaded) { |
| 22 for (uint32_t num_handles = 1u; num_handles <= 10000u; num_handles *= 10u) { | 22 for (uint32_t num_handles = 1u; num_handles <= 10000u; num_handles *= 10u) { |
| 23 RunLoop run_loop; | 23 RunLoop run_loop; |
| 24 | 24 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 (static_cast<double>(end_time - start_time) / 1000000.0); | 38 (static_cast<double>(end_time - start_time) / 1000000.0); |
| 39 char sub_test_name[100] = {}; | 39 char sub_test_name[100] = {}; |
| 40 sprintf(sub_test_name, "%u", static_cast<unsigned>(num_handles)); | 40 sprintf(sub_test_name, "%u", static_cast<unsigned>(num_handles)); |
| 41 test::LogPerfResult("RunLoopAsyncWaitPerftest.SingleThreaded", | 41 test::LogPerfResult("RunLoopAsyncWaitPerftest.SingleThreaded", |
| 42 sub_test_name, result, "callbacks/second"); | 42 sub_test_name, result, "callbacks/second"); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 } // namespace mojo | 47 } // namespace mojo |
| OLD | NEW |