18 #ifndef _DIAGNOSTICMANAGER_HH_
19 #define _DIAGNOSTICMANAGER_HH_
21 #include <boost/unordered_map.hpp>
23 #include <boost/filesystem.hpp>
25 #include "gazebo/gazebo_config.h"
45 #ifdef ENABLE_DIAGNOSTICS
46 #define DIAG_TIMER_START(_name) \
50 gazebo::util::DiagnosticManager::Instance()->StartTimer(_name);
57 #define DIAG_TIMER_LAP(_name, _prefix) \
58 gazebo::util::DiagnosticManager::Instance()->Lap(_name, _prefix);
62 #define DIAG_TIMER_STOP(_name) \
63 gazebo::util::DiagnosticManager::Instance()->StopTimer(_name);
65 #define DIAG_TIMER_START(_name) ((void) 0)
66 #define DIAG_TIMER_LAP(_name, _prefix) ((void)0)
67 #define DIAG_TIMER_STOP(_name) ((void) 0)
83 public:
void Init(
const std::string &_worldName);
88 public:
void StartTimer(
const std::string &_name);
92 public:
void StopTimer(
const std::string &_name);
99 public:
void Lap(
const std::string &_name,
const std::string &_prefix);
103 public:
int GetTimerCount()
const;
113 public:
common::Time GetTime(
const std::string &_label)
const;
118 public: std::string GetLabel(
int _index)
const;
122 public: boost::filesystem::path GetLogPath()
const;
133 private:
void AddTime(
const std::string &_name,
common::Time &_wallTime,
137 private:
typedef boost::unordered_map<std::string, DiagnosticTimerPtr>
141 private: TimerMap timers;
144 private: boost::filesystem::path logPath;
153 private: msgs::Diagnostics msg;
178 public:
void Lap(
const std::string &_prefix);
181 public:
virtual void Start();
184 public:
virtual void Stop();
188 public:
inline const std::string
GetName()
const
189 {
return this->name; }
192 private: std::string name;
195 private: std::ofstream log;
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
Forward declarations for transport.
Singleton template class.
Definition: SingletonT.hh:33
A diagnostic manager class.
Definition: util/Diagnostics.hh:72
const std::string GetName() const
Get the name of the timer.
Definition: util/Diagnostics.hh:188
Information for use in an update event.
Definition: UpdateInfo.hh:30
#define GZ_UTIL_VISIBLE
Definition: system.hh:266
A timer class, used to time things in real world walltime.
Definition: Timer.hh:38
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
A timer designed for diagnostics.
Definition: util/Diagnostics.hh:167
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:39