OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SYSTEM_TEST_UTILS_H_ |
| 6 #define MOJO_SYSTEM_TEST_UTILS_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/time/time.h" |
| 10 |
| 11 namespace mojo { |
| 12 namespace system { |
| 13 namespace test { |
| 14 |
| 15 class Stopwatch { |
| 16 public: |
| 17 Stopwatch() {} |
| 18 ~Stopwatch() {} |
| 19 |
| 20 void Start() { |
| 21 start_time_ = base::TimeTicks::HighResNow(); |
| 22 } |
| 23 |
| 24 int64_t Elapsed() { |
| 25 return (base::TimeTicks::HighResNow() - start_time_).InMicroseconds(); |
| 26 } |
| 27 |
| 28 private: |
| 29 base::TimeTicks start_time_; |
| 30 |
| 31 DISALLOW_COPY_AND_ASSIGN(Stopwatch); |
| 32 }; |
| 33 |
| 34 } // namespace test |
| 35 } // namespace system |
| 36 } // namespace mojo |
| 37 |
| 38 #endif // MOJO_SYSTEM_TEST_UTILS_H_ |
OLD | NEW |