Skip to content
Snippets Groups Projects
CPUTime.h 862 B
Newer Older
  • Learn to ignore specific revisions
  • Lars Bilke's avatar
    Lars Bilke committed
    /**
    
    Lars Bilke's avatar
    Lars Bilke committed
     * \file
     * \author Thomas Fischer
    
     * \author Wenqing Wang
     * \date   2012-05-10, 2014.10.10
    
    Lars Bilke's avatar
    Lars Bilke committed
     * \brief  Definition of the CPUTime class.
     *
     * \copyright
    
     * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
    
    Lars Bilke's avatar
    Lars Bilke committed
     *            Distributed under a Modified BSD License.
     *              See accompanying file LICENSE.txt or
    
    Lars Bilke's avatar
    Lars Bilke committed
     *              http://www.opengeosys.org/project/license
    
    namespace BaseLib
    {
    
    /// Count CPU time
    
        public:
            /// Start the timer.
    
            void start() { start_time_ = clock(); }
    
    wenqing's avatar
    wenqing committed
            /// Get the elapsed time after started.
    
            double elapsed() const
    
                return (clock() - start_time_) /
                       static_cast<double>(CLOCKS_PER_SEC);
    
            double start_time_ = 0.;