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 #ifndef MOJO_PUBLIC_C_ENVIRONMENT_TESTS_ASYNC_WAITER_PERFTEST_HELPERS_H_ | 5 #ifndef MOJO_PUBLIC_C_TESTS_ENVIRONMENT_ASYNC_WAITER_PERFTEST_HELPERS_H_ |
6 #define MOJO_PUBLIC_C_ENVIRONMENT_TESTS_ASYNC_WAITER_PERFTEST_HELPERS_H_ | 6 #define MOJO_PUBLIC_C_TESTS_ENVIRONMENT_ASYNC_WAITER_PERFTEST_HELPERS_H_ |
7 | 7 |
8 #include <mojo/environment/async_waiter.h> | 8 #include <mojo/environment/async_waiter.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <functional> | 11 #include <functional> |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace test { | 14 namespace test { |
15 | 15 |
16 // Basic single-threaded perf test helper for |MojoAsyncWaiter|. This will keep | 16 // Basic single-threaded perf test helper for |MojoAsyncWaiter|. This will keep |
17 // |num_handles| active async waits and activate them one at a time (with each | 17 // |num_handles| active async waits and activate them one at a time (with each |
18 // callback triggering the next). This sets up the test (setting up the initial | 18 // callback triggering the next). This sets up the test (setting up the initial |
19 // set of async waits), calls |run_loop_function|, and once that is done cleans | 19 // set of async waits), calls |run_loop_function|, and once that is done cleans |
20 // up. It returns the number of async waits completed. |run_loop_function| | 20 // up. It returns the number of async waits completed. |run_loop_function| |
21 // should typically run the message/run loop and quit after some fixed amount of | 21 // should typically run the message/run loop and quit after some fixed amount of |
22 // time (it should probably measure the actual amount of time spent running, and | 22 // time (it should probably measure the actual amount of time spent running, and |
23 // the return value should probably be normalized with respect to that). | 23 // the return value should probably be normalized with respect to that). |
24 uint64_t DoAsyncWaiterPerfTest(const MojoAsyncWaiter* async_waiter, | 24 uint64_t DoAsyncWaiterPerfTest(const MojoAsyncWaiter* async_waiter, |
25 uint32_t num_handles, | 25 uint32_t num_handles, |
26 std::function<void()> run_loop_function); | 26 std::function<void()> run_loop_function); |
27 | 27 |
28 } // namespace test | 28 } // namespace test |
29 } // namespace mojo | 29 } // namespace mojo |
30 | 30 |
31 #endif // MOJO_PUBLIC_C_ENVIRONMENT_TESTS_ASYNC_WAITER_PERFTEST_HELPERS_H_ | 31 #endif // MOJO_PUBLIC_C_TESTS_ENVIRONMENT_ASYNC_WAITER_PERFTEST_HELPERS_H_ |
OLD | NEW |