LCOV - code coverage report
Current view: top level - src - utils-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 5 5 100.0 %
Date: 2017-04-26 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright 2016 the V8 project 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 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       80832 :       : start_(TimestampMs()), result_(result) {}
      21             : 
      22       80829 :   ~TimedScope() { *result_ = TimestampMs() - start_; }
      23             : 
      24             :  private:
      25      161661 :   static inline double TimestampMs() {
      26      161661 :     return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
      27      161658 :            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_

Generated by: LCOV version 1.10