17#ifndef _GAZEBO_UTIL_DIAGNOSTICMANAGER_HH_
18#define _GAZEBO_UTIL_DIAGNOSTICMANAGER_HH_
21#include <boost/filesystem.hpp>
23#include "gazebo/gazebo_config.h"
40 class DiagnosticManagerPrivate;
43 class DiagnosticTimerPrivate;
50#ifdef ENABLE_DIAGNOSTICS
54 #define DIAG_TIMER_START(_name) \
55 gazebo::util::DiagnosticManager::Instance()->StartTimer(_name);
62 #define DIAG_TIMER_LAP(_name, _prefix) \
63 gazebo::util::DiagnosticManager::Instance()->Lap(_name, _prefix);
67 #define DIAG_TIMER_STOP(_name) \
68 gazebo::util::DiagnosticManager::Instance()->StopTimer(_name);
70 #define DIAG_TIMER_START(_name) ((void) 0)
71 #define DIAG_TIMER_LAP(_name, _prefix) ((void)0)
72 #define DIAG_TIMER_STOP(_name) ((void) 0)
88 public:
void Init(
const std::string &_worldName);
108 public:
void Lap(
const std::string &_name,
const std::string &_prefix);
127 public: std::string
Label(
const int _index)
const;
131 public: boost::filesystem::path
LogPath()
const;
142 private:
void AddTime(
const std::string &_name,
154 private: std::unique_ptr<DiagnosticManagerPrivate> dataPtr;
170 public:
void Lap(
const std::string &_prefix);
180 public:
const std::string
Name()
const;
188 private: std::unique_ptr<DiagnosticTimerPrivate> dataPtr;
gazebo
Definition Diagnostics.hh:33
util
Definition Diagnostics.hh:33
Singleton template class.
Definition SingletonT.hh:34
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
A timer class, used to time things in real world walltime.
Definition Timer.hh:39
Information for use in an update event.
Definition UpdateInfo.hh:31
A diagnostic manager class.
Definition Diagnostics.hh:79
void Fini()
Finish reporting diagnostics for a world.
std::string Label(const int _index) const
Get a label for a timer.
common::Time Time(const int _index) const
Get the time of a timer instance.
void StopTimer(const std::string &_name)
Stop a currently running timer.
void Init(const std::string &_worldName)
Initialize to report diagnostics about a world.
boost::filesystem::path LogPath() const
Get the path in which logs are stored.
void Lap(const std::string &_name, const std::string &_prefix)
Output the current elapsed time of an active timer with a prefix string.
common::Time Time(const std::string &_label) const
Get a time based on a label.
int TimerCount() const
Get the number of timers.
void StartTimer(const std::string &_name)
Start a new timer instance.
A timer designed for diagnostics.
Definition Diagnostics.hh:160
const std::string Name() const
Get the name of the timer.
DiagnosticTimer(const std::string &_name)
Constructor.
virtual ~DiagnosticTimer()
Destructor.
void InsertData(const std::string &_name, const common::Time &_time)
Insert data for statistics computation.
virtual void Start()
Start the timer.
void Lap(const std::string &_prefix)
Output a lap time.
virtual void Stop()
Stop the timer.
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition SingletonT.hh:58
Forward declarations for the common classes.
Definition Animation.hh:27