hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HCETimer.hpp
Go to the documentation of this file.
1 
8 #ifndef HCE_TIMER_HPP
9 #define HCE_TIMER_HPP
10 
11 
12 
16 #include <Poco/Timestamp.h>
17 
21 #include <ctime>
22 #include <iostream>
23 
24 
25 using Poco::Timestamp;
26 
27 
28 namespace HCE
29 {
30 
31 
32 class HCETimer
33 {
34  public:
35  explicit HCETimer( const std::string& s = "Operation time: " ) : _prompt( s ), _start() {}
37  _stop = _start.elapsed();
38 #ifdef _DEBUG_
39  std::cout << _prompt << toSeconds( _stop ) << std::endl;
40 #endif
41  }
42  public:
43  inline static const double toSeconds( const Timestamp::TimeDiff& microseconds ) { return microseconds / 1000000.; }
44  inline const Poco::UInt64 elapsed() { return _start.elapsed(); }
45  private:
46  std::string _prompt;
47  Timestamp _start;
48  Timestamp::TimeDiff _stop;
49 };
50 
51 
52 } /* namespace HCE */
53 
54 
55 #endif