LCOV - code coverage report
Current view: top level - src/Utility - Timer.cpp (source / functions) Coverage Total Hit
Test: report.info Lines: 100.0 % 18 18
Test Date: 2025-05-21 16:07:51 Functions: 100.0 % 5 5
Branches: 50.0 % 10 5

             Branch data     Line data    Source code
       1                 :             : //
       2                 :             : // Class Timer
       3                 :             : //   This class is used in IpplTimings.
       4                 :             : //
       5                 :             : //
       6                 :             : //
       7                 :             : #include "Kokkos_Core.hpp"
       8                 :             : 
       9                 :             : #include "Timer.h"
      10                 :             : 
      11                 :             : bool Timer::enableFences = IPPL_ENABLE_TIMER_FENCES;
      12                 :             : 
      13                 :         344 : Timer::Timer() {
      14                 :         344 :     this->clear();
      15                 :         344 : }
      16                 :             : 
      17                 :        1000 : void Timer::clear() {
      18                 :        1000 :     elapsed_m = 0.0;
      19                 :        1000 : }
      20                 :             : 
      21                 :         312 : void Timer::start() {
      22                 :         312 :     start_m = std::chrono::high_resolution_clock::now();
      23                 :         312 : }
      24                 :             : 
      25                 :         908 : void Timer::stop() {
      26         [ +  - ]:         908 :     if (enableFences) {
      27   [ +  -  +  - ]:        1816 :         Kokkos::fence();
      28                 :             :     }
      29                 :         908 :     stop_m = std::chrono::high_resolution_clock::now();
      30                 :             : 
      31   [ +  -  +  - ]:         908 :     duration_type elapsed = stop_m - start_m;
      32                 :             : 
      33                 :         908 :     elapsed_m += elapsed.count();
      34                 :         908 : }
      35                 :             : 
      36                 :         252 : double Timer::elapsed() {
      37                 :         252 :     return elapsed_m;
      38                 :             : }
        

Generated by: LCOV version 2.0-1