mptensor  v0.3.0
Parallel Library for Tensor Network Methods
timer.hpp
Go to the documentation of this file.
1 /*
2  mptensor - Parallel Library for Tensor Network Methods
3 
4  Copyright 2016 Satoshi Morita
5 
6  mptensor is free software: you can redistribute it and/or modify it
7  under the terms of the GNU Lesser General Public License as
8  published by the Free Software Foundation, either version 3 of the
9  License, or (at your option) any later version.
10 
11  mptensor is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with mptensor. If not, see
18  <https://www.gnu.org/licenses/>.
19 */
20 
28 #include <mpi.h>
29 
30 #ifndef _TIMER_HPP_
31 #define _TIMER_HPP_
32 
33 namespace examples {
34 namespace benchmark {
35 
36 class Timer {
37  public:
38  Timer(){};
39  void start() { t_start = MPI_Wtime(); };
40  void stop() { t_end = MPI_Wtime(); };
41  double result() { return t_end - t_start; };
42 
43  private:
44  double t_start;
45  double t_end;
46 };
47 
48 } // namespace benchmark
49 } // namespace examples
50 
51 #endif // _TIMER_HPP_
Definition: timer.hpp:36
void stop()
Definition: timer.hpp:40
Timer()
Definition: timer.hpp:38
double result()
Definition: timer.hpp:41
void start()
Definition: timer.hpp:39
Definition: timer.hpp:33