LCOV - code coverage report
Current view: top level - src/profiler - circular-queue-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 17 17 100.0 %
Date: 2019-01-20 Functions: 12 12 100.0 %

          Line data    Source code
       1             : // Copyright 2011 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_PROFILER_CIRCULAR_QUEUE_INL_H_
       6             : #define V8_PROFILER_CIRCULAR_QUEUE_INL_H_
       7             : 
       8             : #include "src/profiler/circular-queue.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : template<typename T, unsigned L>
      14             : SamplingCircularQueue<T, L>::SamplingCircularQueue()
      15             :     : enqueue_pos_(buffer_),
      16      196136 :       dequeue_pos_(buffer_) {
      17             : }
      18             : 
      19             : template <typename T, unsigned L>
      20             : SamplingCircularQueue<T, L>::~SamplingCircularQueue() = default;
      21             : 
      22             : template<typename T, unsigned L>
      23     1843713 : T* SamplingCircularQueue<T, L>::Peek() {
      24             :   base::SeqCst_MemoryFence();
      25     3687426 :   if (base::Acquire_Load(&dequeue_pos_->marker) == kFull) {
      26      566789 :     return &dequeue_pos_->record;
      27             :   }
      28             :   return nullptr;
      29             : }
      30             : 
      31             : 
      32             : template<typename T, unsigned L>
      33       26886 : void SamplingCircularQueue<T, L>::Remove() {
      34       26886 :   base::Release_Store(&dequeue_pos_->marker, kEmpty);
      35       53772 :   dequeue_pos_ = Next(dequeue_pos_);
      36       26886 : }
      37             : 
      38             : 
      39             : template<typename T, unsigned L>
      40       27147 : T* SamplingCircularQueue<T, L>::StartEnqueue() {
      41             :   base::SeqCst_MemoryFence();
      42       54294 :   if (base::Acquire_Load(&enqueue_pos_->marker) == kEmpty) {
      43       27092 :     return &enqueue_pos_->record;
      44             :   }
      45             :   return nullptr;
      46             : }
      47             : 
      48             : 
      49             : template<typename T, unsigned L>
      50       27092 : void SamplingCircularQueue<T, L>::FinishEnqueue() {
      51       27092 :   base::Release_Store(&enqueue_pos_->marker, kFull);
      52       54184 :   enqueue_pos_ = Next(enqueue_pos_);
      53       27092 : }
      54             : 
      55             : 
      56             : template<typename T, unsigned L>
      57             : typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next(
      58             :     Entry* entry) {
      59       53978 :   Entry* next = entry + 1;
      60       53978 :   if (next == &buffer_[L]) return buffer_;
      61             :   return next;
      62             : }
      63             : 
      64             : }  // namespace internal
      65             : }  // namespace v8
      66             : 
      67             : #endif  // V8_PROFILER_CIRCULAR_QUEUE_INL_H_

Generated by: LCOV version 1.10