LCOV - code coverage report
Current view: top level - src/profiler - circular-queue-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 13 13 100.0 %
Date: 2019-04-17 Functions: 6 6 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      204543 :       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     1960803 : T* SamplingCircularQueue<T, L>::Peek() {
      24             :   base::SeqCst_MemoryFence();
      25     3921606 :   if (base::Acquire_Load(&dequeue_pos_->marker) == kFull) {
      26      927522 :     return &dequeue_pos_->record;
      27             :   }
      28             :   return nullptr;
      29             : }
      30             : 
      31             : 
      32             : template<typename T, unsigned L>
      33             : void SamplingCircularQueue<T, L>::Remove() {
      34       66713 :   base::Release_Store(&dequeue_pos_->marker, kEmpty);
      35      133426 :   dequeue_pos_ = Next(dequeue_pos_);
      36             : }
      37             : 
      38             : 
      39             : template<typename T, unsigned L>
      40       66944 : T* SamplingCircularQueue<T, L>::StartEnqueue() {
      41             :   base::SeqCst_MemoryFence();
      42      133888 :   if (base::Acquire_Load(&enqueue_pos_->marker) == kEmpty) {
      43       66889 :     return &enqueue_pos_->record;
      44             :   }
      45             :   return nullptr;
      46             : }
      47             : 
      48             : 
      49             : template<typename T, unsigned L>
      50             : void SamplingCircularQueue<T, L>::FinishEnqueue() {
      51       66889 :   base::Release_Store(&enqueue_pos_->marker, kFull);
      52      133778 :   enqueue_pos_ = Next(enqueue_pos_);
      53             : }
      54             : 
      55             : 
      56             : template<typename T, unsigned L>
      57             : typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next(
      58             :     Entry* entry) {
      59      133602 :   Entry* next = entry + 1;
      60      133602 :   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