diff options
Diffstat (limited to 'mojo/system/test_utils.h')
-rw-r--r-- | mojo/system/test_utils.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mojo/system/test_utils.h b/mojo/system/test_utils.h new file mode 100644 index 0000000..2f1e956 --- /dev/null +++ b/mojo/system/test_utils.h @@ -0,0 +1,38 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SYSTEM_TEST_UTILS_H_ +#define MOJO_SYSTEM_TEST_UTILS_H_ + +#include "base/basictypes.h" +#include "base/time/time.h" + +namespace mojo { +namespace system { +namespace test { + +class Stopwatch { + public: + Stopwatch() {} + ~Stopwatch() {} + + void Start() { + start_time_ = base::TimeTicks::HighResNow(); + } + + int64_t Elapsed() { + return (base::TimeTicks::HighResNow() - start_time_).InMicroseconds(); + } + + private: + base::TimeTicks start_time_; + + DISALLOW_COPY_AND_ASSIGN(Stopwatch); +}; + +} // namespace test +} // namespace system +} // namespace mojo + +#endif // MOJO_SYSTEM_TEST_UTILS_H_ |