LCOV - code coverage report
Current view: top level - components/ComponentModels - C11Timer.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 3 19 15.8 %
Date: 2024-12-11 20:54:31 Functions: 2 8 25.0 %

          Line data    Source code
       1             : //# Copyright (C) 1998,1999,2000,2001,2003
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This program is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU General Public License as published by the Free
       6             : //# Software Foundation; either version 2 of the License, or (at your option)
       7             : //# any later version.
       8             : //#
       9             : //# This program is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
      12             : //# more details.
      13             : //#
      14             : //# You should have received a copy of the GNU General Public License along
      15             : //# with this program; if not, write to the Free Software Foundation, Inc.,
      16             : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: casa-feedback@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : 
      26             : #include <components/ComponentModels/C11Timer.h>
      27             : 
      28             : using namespace std::chrono;
      29             : 
      30             : using namespace casacore;
      31             : namespace casa {
      32       28760 : C11Timer::C11Timer()
      33       28760 :         : _start(), _duration(), _totalDuration(), _nCycles(0) {}
      34             : 
      35       28760 : C11Timer::~C11Timer() {}
      36             : 
      37           0 : Double C11Timer::duration() const {
      38           0 :         return _duration.count();
      39             : }
      40             : 
      41           0 : Double C11Timer::meanDuration() const {
      42           0 :         return _duration.count()/_nCycles;
      43             : }
      44             : 
      45           0 : uInt C11Timer::nCycles() const {
      46           0 :         return _nCycles;
      47             : }
      48             : 
      49           0 : void C11Timer::start() {
      50           0 :         _start = steady_clock::now();
      51           0 : }
      52             : 
      53           0 : void C11Timer::stop() {
      54           0 :         _duration = steady_clock::now() - _start;
      55             :         /*
      56             :         _duration = duration_cast<duration<double>> >(
      57             :                 steady_clock::now() - _start
      58             :         );
      59             :         */
      60           0 :         _totalDuration += _duration;
      61           0 :         ++_nCycles;
      62           0 : }
      63             : 
      64           0 : Double C11Timer::totalDuration() const {
      65           0 :         return _totalDuration.count();
      66             : }
      67             : 
      68             : }
      69             : 
      70             : 

Generated by: LCOV version 1.16