LifeV
WallClock.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5 Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6 Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8 This file is part of LifeV.
9 
10 LifeV is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14 
15 LifeV is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 /*!
27  @file
28  @brief Wall clock timer class
29 
30  @date 01.10.2010
31  @author Radu Popescu <radu.popescu@epfl.ch>
32 
33  @maintainer Radu Popescu <radu.popescu@epfl.ch>
34 */
35 
36 #include "WallClock.hpp"
37 
38 #include <cstdlib>
39 
40 namespace LifeV
41 {
42 // ==========================
43 // Constructor and destructor
44 // ==========================
46 {
47  reset();
48 }
49 
51 {
52 }
53 
54 // ==========================
55 // Public methods
56 // ==========================
57 
59 {
60  gettimeofday (&M_startTime, NULL);
61 }
62 
63 void WallClock::stop()
64 {
65  gettimeofday (&M_stopTime, NULL);
66 
67  time_t seconds = M_stopTime.tv_sec - M_startTime.tv_sec;
68  suseconds_t microseconds = M_stopTime.tv_usec - M_startTime.tv_usec;
69 
70  M_elapsedTime += static_cast<double> (seconds + microseconds / 1000000.0);
71 }
72 
74 {
75  M_elapsedTime = 0;
76 }
77 
78 } // namespace LifeV
time_Type M_stopTime
Definition: WallClock.hpp:87
time_Type M_startTime
Definition: WallClock.hpp:86
Wall clock timer class.
Definition: WallClock.hpp:48
void updateInverseJacobian(const UInt &iQuadPt)
double M_elapsedTime
Definition: WallClock.hpp:89