22 #ifndef _DIAGNOSTICMANAGER_HH_
23 #define _DIAGNOSTICMANAGER_HH_
25 #include <boost/unordered_map.hpp>
27 #include <boost/filesystem.hpp>
29 #include "gazebo/gazebo_config.h"
49 #ifdef ENABLE_DIAGNOSTICS
50 #define DIAG_TIMER_START(_name) \
54 gazebo::util::DiagnosticManager::Instance()->StartTimer(_name);
61 #define DIAG_TIMER_LAP(_name, _prefix) \
62 gazebo::util::DiagnosticManager::Instance()->Lap(_name, _prefix);
66 #define DIAG_TIMER_STOP(_name) \
67 gazebo::util::DiagnosticManager::Instance()->StopTimer(_name);
69 #define DIAG_TIMER_START(_name) ((void) 0)
70 #define DIAG_TIMER_LAP(_name, _prefix) ((void)0)
71 #define DIAG_TIMER_STOP(_name) ((void) 0)
87 public:
void Init(
const std::string &_worldName);
92 public:
void StartTimer(
const std::string &_name);
96 public:
void StopTimer(
const std::string &_name);
103 public:
void Lap(
const std::string &_name,
const std::string &_prefix);
107 public:
int GetTimerCount()
const;
117 public:
common::Time GetTime(
const std::string &_label)
const;
122 public: std::string GetLabel(
int _index)
const;
126 public: boost::filesystem::path GetLogPath()
const;
137 private:
void AddTime(
const std::string &_name,
common::Time &_wallTime,
141 private:
typedef boost::unordered_map<std::string, DiagnosticTimerPtr>
145 private: TimerMap timers;
148 private: boost::filesystem::path logPath;
157 private: msgs::Diagnostics msg;
182 public:
void Lap(
const std::string &_prefix);
185 public:
virtual void Start();
188 public:
virtual void Stop();
192 public:
inline const std::string
GetName()
const
193 {
return this->name; }
196 private: std::string name;
199 private: std::ofstream log;
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:144
Forward declarations for transport.
Singleton template class.
Definition: SingletonT.hh:33
A diagnostic manager class.
Definition: util/Diagnostics.hh:76
const std::string GetName() const
Get the name of the timer.
Definition: util/Diagnostics.hh:192
Information for use in an update event.
Definition: UpdateInfo.hh:30
A timer class, used to time things in real world walltime.
Definition: Timer.hh:38
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:52
A timer designed for diagnostics.
Definition: util/Diagnostics.hh:171
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:44
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:43