Chromium Code Reviews| Index: src/utils-inl.h |
| diff --git a/src/utils-inl.h b/src/utils-inl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..549a75594401af2718cb149421cf20b935c14a0b |
| --- /dev/null |
| +++ b/src/utils-inl.h |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2015 the V8 project authors. All rights reserved. |
|
Hannes Payer (out of office)
2016/01/25 16:04:13
It is 2016.
Michael Lippautz
2016/01/25 16:26:15
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef V8_UTILS_INL_H_ |
| +#define V8_UTILS_INL_H_ |
| + |
| +#include "src/utils.h" |
| + |
| +#include "include/v8-platform.h" |
| +#include "src/base/platform/time.h" |
| +#include "src/v8.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| + |
| +class TimedScope { |
| + public: |
| + explicit TimedScope(double* result) |
| + : start_(TimestampMs()), result_(result) {} |
| + |
| + ~TimedScope() { *result_ = TimestampMs() - start_; } |
| + |
| + private: |
| + static inline double TimestampMs() { |
| + return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
| + static_cast<double>(base::Time::kMillisecondsPerSecond); |
| + } |
| + |
| + double start_; |
| + double* result_; |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace v8 |
| + |
| +#endif // V8_UTILS_INL_H_ |