LCOV - code coverage report
Current view: top level - src/base - cpu_profiler_guard.cc (source / functions) Hit Total Coverage
Test: vlink Lines: 8 8 100.0 %
Date: 2026-06-27 19:56:04 Functions: 2 2 100.0 %
Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2026 by Thun Lu. All rights reserved.
       3                 :            :  * Author: Thun Lu <thun.lu@zohomail.cn>
       4                 :            :  * Repo:   https://github.com/thun-res/vlink
       5                 :            :  *  _    __   __      _           __
       6                 :            :  * | |  / /  / /     (_) ____    / /__
       7                 :            :  * | | / /  / /     / / / __ \  / //_/
       8                 :            :  * | |/ /  / /___  / / / / / / / ,<
       9                 :            :  * |___/  /_____/ /_/ /_/ /_/ /_/|_|
      10                 :            :  *
      11                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
      12                 :            :  * you may not use this file except in compliance with the License.
      13                 :            :  * You may obtain a copy of the License at
      14                 :            :  *
      15                 :            :  *     http://www.apache.org/licenses/LICENSE-2.0
      16                 :            :  *
      17                 :            :  * Unless required by applicable law or agreed to in writing, software
      18                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      19                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      20                 :            :  * See the License for the specific language governing permissions and
      21                 :            :  * limitations under the License.
      22                 :            :  */
      23                 :            : 
      24                 :            : #include "./base/cpu_profiler_guard.h"
      25                 :            : 
      26                 :            : #include "./base/cpu_profiler.h"
      27                 :            : 
      28                 :            : namespace vlink {
      29                 :            : 
      30                 :            : // CpuProfilerGuard
      31                 :       2015 : CpuProfilerGuard::CpuProfilerGuard(CpuProfiler* profiler) noexcept : profiler_(profiler) {
      32         [ +  + ]:       2015 :   if VLIKELY (profiler_) {
      33                 :          4 :     profiler_->begin();
      34                 :            :   }
      35                 :       2015 : }
      36                 :            : 
      37                 :       2019 : CpuProfilerGuard::~CpuProfilerGuard() noexcept {
      38         [ +  + ]:       2019 :   if VLIKELY (profiler_) {
      39                 :          4 :     profiler_->end();
      40                 :            :   }
      41                 :       2019 : }
      42                 :            : 
      43                 :            : }  // namespace vlink

Generated by: LCOV version 1.14