Go to the documentation of this file.
17 #ifndef _GAZEBO_UTIL_DIAGNOSTICMANAGER_HH_
18 #define _GAZEBO_UTIL_DIAGNOSTICMANAGER_HH_
21 #include <boost/filesystem.hpp>
23 #include "gazebo/gazebo_config.h"
37 class DiagnosticManagerPrivate;
40 class DiagnosticTimerPrivate;
47 #ifdef ENABLE_DIAGNOSTICS
48 #define DIAG_TIMER_START(_name) \
52 gazebo::util::DiagnosticManager::Instance()->StartTimer(_name);
59 #define DIAG_TIMER_LAP(_name, _prefix) \
60 gazebo::util::DiagnosticManager::Instance()->Lap(_name, _prefix);
64 #define DIAG_TIMER_STOP(_name) \
65 gazebo::util::DiagnosticManager::Instance()->StopTimer(_name);
67 #define DIAG_TIMER_START(_name) ((void) 0)
68 #define DIAG_TIMER_LAP(_name, _prefix) ((void)0)
69 #define DIAG_TIMER_STOP(_name) ((void) 0)
85 public:
void Init(
const std::string &_worldName);
94 public:
void StartTimer(
const std::string &_name);
98 public:
void StopTimer(
const std::string &_name);
105 public:
void Lap(
const std::string &_name,
const std::string &_prefix);
109 public:
int TimerCount()
const;
119 public:
common::Time Time(
const std::string &_label)
const;
124 public: std::string Label(
const int _index)
const;
128 public: boost::filesystem::path LogPath()
const;
139 private:
void AddTime(
const std::string &_name,
151 private: std::unique_ptr<DiagnosticManagerPrivate> dataPtr;
167 public:
void Lap(
const std::string &_prefix);
170 public:
virtual void Start();
173 public:
virtual void Stop();
177 public:
const std::string Name()
const;
180 public:
void InsertData(
const std::string &_name,
185 private: std::unique_ptr<DiagnosticTimerPrivate> dataPtr;
DiagnosticTimer(const std::string &_name)
Constructor.
Forward declarations for the common classes.
Definition: Animation.hh:26
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:44
void InsertData(const std::string &_name, const common::Time &_time)
Insert data for statistics computation.
Singleton template class.
Definition: SingletonT.hh:33
common::Time Time(const int _index) const
Get the time of a timer instance.
int TimerCount() const
Get the number of timers.
boost::filesystem::path LogPath() const
Get the path in which logs are stored.
const std::string Name() const
Get the name of the timer.
void StopTimer(const std::string &_name)
Stop a currently running timer.
A timer class, used to time things in real world walltime.
Definition: Timer.hh:38
virtual void Stop()
Stop the timer.
void Lap(const std::string &_prefix)
Output a lap time.
virtual void Start()
Start the timer.
virtual ~DiagnosticTimer()
Destructor.
void Init(const std::string &_worldName)
Initialize to report diagnostics about a world.
std::string Label(const int _index) const
Get a label for a timer.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
void Fini()
Finish reporting diagnostics for a world.
A timer designed for diagnostics.
Definition: Diagnostics.hh:156
A diagnostic manager class.
Definition: Diagnostics.hh:74
void StartTimer(const std::string &_name)
Start a new timer instance.
Information for use in an update event.
Definition: UpdateInfo.hh:30
void Lap(const std::string &_name, const std::string &_prefix)
Output the current elapsed time of an active timer with a prefix string.