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

Side by Side Diff: mojo/edk/system/test/stopwatch.h

Issue 1435043002: EDK: Sprinkle some more |final| secret sauce. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « mojo/edk/system/test/scoped_test_dir.h ('k') | mojo/edk/system/test/test_io_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. 5 // A simple "stopwatch" for measuring elapsed time.
6 6
7 #ifndef MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_ 7 #ifndef MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_
8 #define MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_ 8 #define MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_
9 9
10 #include "mojo/edk/embedder/simple_platform_support.h" 10 #include "mojo/edk/embedder/simple_platform_support.h"
11 #include "mojo/public/c/system/types.h" 11 #include "mojo/public/c/system/types.h"
12 #include "mojo/public/cpp/system/macros.h" 12 #include "mojo/public/cpp/system/macros.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 namespace test { 16 namespace test {
17 17
18 // A simple "stopwatch" for measuring time elapsed from a given starting point. 18 // A simple "stopwatch" for measuring time elapsed from a given starting point.
19 class Stopwatch { 19 class Stopwatch final {
20 public: 20 public:
21 Stopwatch(); 21 Stopwatch();
22 ~Stopwatch(); 22 ~Stopwatch();
23 23
24 void Start(); 24 void Start();
25 // Returns the amount of time elapsed since the last call to |Start()| (in 25 // Returns the amount of time elapsed since the last call to |Start()| (in
26 // microseconds). 26 // microseconds).
27 MojoDeadline Elapsed(); 27 MojoDeadline Elapsed();
28 28
29 private: 29 private:
30 // TODO(vtl): We need this for |GetTimeTicksNow()|. Maybe we should have a 30 // TODO(vtl): We need this for |GetTimeTicksNow()|. Maybe we should have a
31 // singleton for tests instead? Or maybe it should be injected? 31 // singleton for tests instead? Or maybe it should be injected?
32 embedder::SimplePlatformSupport platform_support_; 32 embedder::SimplePlatformSupport platform_support_;
33 33
34 MojoTimeTicks start_time_; 34 MojoTimeTicks start_time_;
35 35
36 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch); 36 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch);
37 }; 37 };
38 38
39 } // namespace test 39 } // namespace test
40 } // namespace system 40 } // namespace system
41 } // namespace mojo 41 } // namespace mojo
42 42
43 #endif // MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_ 43 #endif // MOJO_EDK_SYSTEM_TEST_STOPWATCH_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/test/scoped_test_dir.h ('k') | mojo/edk/system/test/test_io_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698