OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_PUBLIC_C_TESTS_SYSTEM_PERFTEST_UTILS_H_ | |
6 #define MOJO_PUBLIC_C_TESTS_SYSTEM_PERFTEST_UTILS_H_ | |
7 | |
8 #include <mojo/system/time.h> | |
9 | |
10 #include <functional> | |
11 | |
12 namespace mojo { | |
13 namespace test { | |
14 | |
15 // How long to run each perf test for (in microseconds). | |
16 constexpr MojoTimeTicks kPerftestTimeMicroseconds = 3 * 1000000; | |
17 | |
18 // Iterates the given function for |kPerftestTimeMicroseconds| and reports the | |
19 // number of iterations executed per second. | |
20 void IterateAndReportPerf(const char* test_name, | |
21 const char* sub_test_name, | |
22 std::function<void()> single_iteration); | |
23 | |
24 // Sleeps for the given amount of time (in microseconds). | |
25 void Sleep(MojoTimeTicks microseconds); | |
26 | |
27 } // namespace test | |
28 } // namespace mojo | |
29 | |
30 #endif // MOJO_PUBLIC_C_TESTS_SYSTEM_PERFTEST_UTILS_H_ | |
OLD | NEW |