code_profiler
include
profiling
StatsPublisher.h
Go to the documentation of this file.
1
#ifndef CODE_PROFILER_STATS_PUBLISHER_H_
2
#define CODE_PROFILER_STATS_PUBLISHER_H_
3
4
#include <
string
>
5
#include <
map
>
6
#include <
stack
>
7
#include <ros/publisher.h>
8
9
#include "
profiling/Timer.h
"
10
11
struct
ScopeStat
12
{
13
14
ScopeStat
() {}
15
16
ScopeStat
(
const
std::string
& name_) :
name
(name_) {}
17
18
std::string
name
;
19
Timer
timer
;
20
};
21
22
class
StatsPublisher
23
{
24
25
public
:
26
27
StatsPublisher
();
28
29
virtual
~StatsPublisher
();
30
31
void
initialize
();
32
33
void
startTimer
(
const
std::string
& label);
34
35
void
stopTimer
(
const
std::string
& label);
36
37
void
publish
()
const
;
38
39
protected
:
40
41
ros::Publisher
pub_stats_
;
42
43
std::map<std::string, Timer>
timers_
;
44
45
std::stack<ScopeStat>
stack_
;
46
47
48
49
50
};
51
52
#endif
StatsPublisher::startTimer
void startTimer(const std::string &label)
Definition:
StatsPublisher.cpp:28
std::string
StatsPublisher::stopTimer
void stopTimer(const std::string &label)
Definition:
StatsPublisher.cpp:36
StatsPublisher::initialize
void initialize()
Definition:
StatsPublisher.cpp:20
stack
StatsPublisher::stack_
std::stack< ScopeStat > stack_
Definition:
StatsPublisher.h:45
StatsPublisher::pub_stats_
ros::Publisher pub_stats_
Definition:
StatsPublisher.h:41
ScopeStat::name
std::string name
Definition:
StatsPublisher.h:18
StatsPublisher::timers_
std::map< std::string, Timer > timers_
Definition:
StatsPublisher.h:43
ScopeStat::ScopeStat
ScopeStat()
Definition:
StatsPublisher.h:14
Timer
Definition:
Timer.h:28
StatsPublisher::~StatsPublisher
virtual ~StatsPublisher()
Definition:
StatsPublisher.cpp:14
Timer.h
StatsPublisher::publish
void publish() const
Definition:
StatsPublisher.cpp:61
map
ScopeStat
Definition:
StatsPublisher.h:11
ScopeStat::ScopeStat
ScopeStat(const std::string &name_)
Definition:
StatsPublisher.h:16
StatsPublisher
Definition:
StatsPublisher.h:22
StatsPublisher::StatsPublisher
StatsPublisher()
Definition:
StatsPublisher.cpp:8
ScopeStat::timer
Timer timer
Definition:
StatsPublisher.h:19
string
Generated on Sun Feb 23 2025 04:33:26 for code_profiler by
1.8.17