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 #include "mojo/public/c/system/tests/perftest_utils.h" | 5 #include "mojo/public/c/system/tests/perftest_utils.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
| 11 #include "mojo/public/c/system/macros.h" |
11 #include "mojo/public/c/system/time.h" | 12 #include "mojo/public/c/system/time.h" |
12 #include "mojo/public/cpp/system/macros.h" | |
13 #include "mojo/public/cpp/test_support/test_support.h" | 13 #include "mojo/public/cpp/test_support/test_support.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace test { | 16 namespace test { |
17 | 17 |
18 // Iterates the given function for |kPerftestTimeMicroseconds| and reports the | 18 // Iterates the given function for |kPerftestTimeMicroseconds| and reports the |
19 // number of iterations executed per second. | 19 // number of iterations executed per second. |
20 void IterateAndReportPerf(const char* test_name, | 20 void IterateAndReportPerf(const char* test_name, |
21 const char* sub_test_name, | 21 const char* sub_test_name, |
22 std::function<void()> single_iteration) { | 22 std::function<void()> single_iteration) { |
(...skipping 21 matching lines...) Expand all Loading... |
44 static_cast<time_t>(microseconds / 1000000), // Seconds. | 44 static_cast<time_t>(microseconds / 1000000), // Seconds. |
45 static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds. | 45 static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds. |
46 }; | 46 }; |
47 int rv = nanosleep(&req, nullptr); | 47 int rv = nanosleep(&req, nullptr); |
48 MOJO_ALLOW_UNUSED_LOCAL(rv); | 48 MOJO_ALLOW_UNUSED_LOCAL(rv); |
49 assert(rv == 0); | 49 assert(rv == 0); |
50 } | 50 } |
51 | 51 |
52 } // namespace test | 52 } // namespace test |
53 } // namespace mojo | 53 } // namespace mojo |
OLD | NEW |