StopWatch.hpp
Go to the documentation of this file.
1//===========================================================================
2//
3// File: StopWatch.hpp
4//
5// Created: Thu Jul 2 23:04:17 2009
6//
7// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8//
9// $Date$
10//
11// $Revision$
12//
13//===========================================================================
14
15/*
16 Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
17 Copyright 2009, 2010 Statoil ASA.
18
19 This file is part of the Open Porous Media project (OPM).
20
21 OPM is free software: you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation, either version 3 of the License, or
24 (at your option) any later version.
25
26 OPM is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
30
31 You should have received a copy of the GNU General Public License
32 along with OPM. If not, see <http://www.gnu.org/licenses/>.
33*/
34
35#ifndef OPM_STOPWATCH_HEADER
36#define OPM_STOPWATCH_HEADER
37
38#include <chrono>
39
40namespace Opm
41{
42
43 namespace time
44 {
45
47 {
48 public:
52
55 void start();
58 void stop();
59
63 double secsSinceLast();
67
68 private:
69 enum class State { UnStarted, Running, Stopped };
70 using TimePoint = std::chrono::high_resolution_clock::time_point;
71
72 TimePoint currentTime() const;
73
74 State state_;
75 TimePoint start_time_;
76 TimePoint last_time_;
77 TimePoint stop_time_;
78 };
79
80 } // namespace time
81
82} // namespace Opm
83
84#endif // OPM_STOPWATCH_HEADER
Definition: StopWatch.hpp:47
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.hpp:26