| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file timer.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Tue Sep 6 16:17:40 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Class to measure timings.
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef TIMER_HPP_
|
|---|
| 11 | #define TIMER_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #include <map>
|
|---|
| 14 | #include <string>
|
|---|
| 15 |
|
|---|
| 16 | #include "thirdparty/pugixml/pugixml.hpp"
|
|---|
| 17 |
|
|---|
| 18 | namespace VMG
|
|---|
| 19 | {
|
|---|
| 20 |
|
|---|
| 21 | struct TimerData
|
|---|
| 22 | {
|
|---|
| 23 | TimerData():
|
|---|
| 24 | time_start(0.0),
|
|---|
| 25 | duration(0.0),
|
|---|
| 26 | warning(0),
|
|---|
| 27 | total(0)
|
|---|
| 28 | {}
|
|---|
| 29 |
|
|---|
| 30 | double time_start;
|
|---|
| 31 | double duration;
|
|---|
| 32 | int warning;
|
|---|
| 33 | int total;
|
|---|
| 34 | };
|
|---|
| 35 |
|
|---|
| 36 | class Timer
|
|---|
| 37 | {
|
|---|
| 38 | public:
|
|---|
| 39 | Timer() {}
|
|---|
| 40 | ~Timer() {}
|
|---|
| 41 |
|
|---|
| 42 | static void Start(std::string event);
|
|---|
| 43 | static void Stop(std::string event);
|
|---|
| 44 | static void Clear();
|
|---|
| 45 |
|
|---|
| 46 | static pugi::xml_node ToXMLNode();
|
|---|
| 47 | static std::string ToString();
|
|---|
| 48 | static void Print();
|
|---|
| 49 |
|
|---|
| 50 | static std::map<std::string, TimerData> td;
|
|---|
| 51 |
|
|---|
| 52 | private:
|
|---|
| 53 | static std::string active_timer;
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | std::ostream& operator<<(std::ostream& out, const Timer&);
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | #endif /* TIMER_HPP_ */
|
|---|
| 61 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.