Skip to content
Snippets Groups Projects
CPUTime.h 920 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-2014, 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
    
    Lars Bilke's avatar
    Lars Bilke committed
     *
    
    namespace BaseLib
    {
    
    /// Record CPU time
    
        public:
            /// Start the timer.
            void start()
            {
                _timer = - clock()/static_cast<double>(CLOCKS_PER_SEC);
            }
    
            /// Get the epalsed time after started.
            double elapsed()
            {
                return _timer + clock()/static_cast<double>(CLOCKS_PER_SEC);
            }
        private:
            double _timer = 0.;