Timer.h 1.32 KB
Newer Older
1
2
3
4
5
6
7
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
8
 * Authors:
9
10
11
12
13
14
15
16
17
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
18
 *
19
 ******************************************************************************/
Naumann, Andreas's avatar
Naumann, Andreas committed
20
21
22
#ifndef AMDIS_TIMER_H
#define AMDIS_TIMER_H

23
#include "boost/date_time/posix_time/posix_time.hpp"
Naumann, Andreas's avatar
Naumann, Andreas committed
24

25
namespace AMDiS {
26

27
28
29
30
31
32
  /// Helper class to distinguish between different time measurement methods
  class Timer
  {
  private:
    /// begin value for sequentiell measurement
    boost::posix_time::ptime first_seq;
Naumann, Andreas's avatar
Naumann, Andreas committed
33

34
35
    /// begin value for parallel measurement
    double first_mpi;
Naumann, Andreas's avatar
Naumann, Andreas committed
36

37
38
39
  public:
    /// initializes the timer with current time
    Timer();
Naumann, Andreas's avatar
Naumann, Andreas committed
40

41
42
    /// resets the timer to current time
    void reset();
Naumann, Andreas's avatar
Naumann, Andreas committed
43

44
    /// returns the elapsed time (from construction or last reset) to now in seconds
Praetorius, Simon's avatar
Praetorius, Simon committed
45
    double elapsed() const;
46
  };
Naumann, Andreas's avatar
Naumann, Andreas committed
47
}
48
49

#endif // AMDIS_TIMER_H