Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: mojo/edk/platform/test_stopwatch.h

Issue 1783623005: Add mojo/c/system/{time.h,wait.h}. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // A simple "stopwatch" for measuring elapsed time in tests. 5 // A simple "stopwatch" for measuring elapsed time in tests.
6 6
7 #ifndef MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_ 7 #ifndef MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_
8 #define MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_ 8 #define MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_
9 9
10 #include "mojo/public/c/system/types.h" 10 #include "mojo/public/c/system/time.h"
11 #include "mojo/public/cpp/system/macros.h" 11 #include "mojo/public/cpp/system/macros.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 namespace platform { 14 namespace platform {
15 namespace test { 15 namespace test {
16 16
17 // A simple "stopwatch" for measuring time elapsed from a given starting point. 17 // A simple "stopwatch" for measuring time elapsed from a given starting point.
18 class Stopwatch final { 18 class Stopwatch final {
19 public: 19 public:
20 Stopwatch() {} 20 Stopwatch() {}
21 ~Stopwatch() {} 21 ~Stopwatch() {}
22 22
23 void Start(); 23 void Start();
24 // Returns the amount of time elapsed since the last call to |Start()| (in 24 // Returns the amount of time elapsed since the last call to |Start()| (in
25 // microseconds). 25 // microseconds).
26 MojoDeadline Elapsed(); 26 MojoDeadline Elapsed();
27 27
28 private: 28 private:
29 MojoTimeTicks start_time_ = 0; 29 MojoTimeTicks start_time_ = 0;
30 30
31 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch); 31 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch);
32 }; 32 };
33 33
34 } // namespace test 34 } // namespace test
35 } // namespace platform 35 } // namespace platform
36 } // namespace mojo 36 } // namespace mojo
37 37
38 #endif // MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_ 38 #endif // MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698