OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
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 V8_UTILS_INL_H_ | |
6 #define V8_UTILS_INL_H_ | |
7 | |
8 #include "src/utils.h" | |
9 | |
10 #include "include/v8-platform.h" | |
11 #include "src/base/platform/time.h" | |
12 #include "src/v8.h" | |
13 | |
14 namespace v8 { | |
15 namespace internal { | |
16 | |
17 class TimedScope { | |
18 public: | |
19 explicit TimedScope(double* result) | |
20 : start_(TimestampMs()), result_(result) {} | |
21 | |
22 ~TimedScope() { *result_ = TimestampMs() - start_; } | |
23 | |
24 private: | |
25 static inline double TimestampMs() { | |
26 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * | |
27 static_cast<double>(base::Time::kMillisecondsPerSecond); | |
28 } | |
29 | |
30 double start_; | |
31 double* result_; | |
32 }; | |
33 | |
34 } // namespace internal | |
35 } // namespace v8 | |
36 | |
37 #endif // V8_UTILS_INL_H_ | |
OLD | NEW |