Apollo 10.0
自动驾驶开放平台
apollo::monitor::LatencyMonitor类 参考

#include <latency_monitor.h>

类 apollo::monitor::LatencyMonitor 继承关系图:
apollo::monitor::LatencyMonitor 的协作图:

Public 成员函数

 LatencyMonitor ()
 
void RunOnce (const double current_time) override
 
bool GetFrequency (const std::string &channel_name, double *freq)
 
- Public 成员函数 继承自 apollo::monitor::RecurrentRunner
 RecurrentRunner (const std::string &name, const double interval)
 
virtual ~RecurrentRunner ()=default
 
void Tick (const double current_time)
 

额外继承的成员函数

- Protected 属性 继承自 apollo::monitor::RecurrentRunner
std::string name_
 
unsigned int round_count_ = 0
 

详细描述

在文件 latency_monitor.h31 行定义.

构造及析构函数说明

◆ LatencyMonitor()

apollo::monitor::LatencyMonitor::LatencyMonitor ( )

在文件 latency_monitor.cc89 行定义.

90 : RecurrentRunner(FLAGS_latency_monitor_name,
91 FLAGS_latency_monitor_interval) {}
RecurrentRunner(const std::string &name, const double interval)

成员函数说明

◆ GetFrequency()

bool apollo::monitor::LatencyMonitor::GetFrequency ( const std::string &  channel_name,
double *  freq 
)

在文件 latency_monitor.cc216 行定义.

217 {
218 if (freq_map_.find(channel_name) == freq_map_.end()) {
219 return false;
220 }
221 *freq = freq_map_[channel_name];
222 return true;
223}

◆ RunOnce()

void apollo::monitor::LatencyMonitor::RunOnce ( const double  current_time)
overridevirtual

实现了 apollo::monitor::RecurrentRunner.

在文件 latency_monitor.cc93 行定义.

93 {
94 static auto reader =
95 MonitorManager::Instance()->CreateReader<LatencyRecordMap>(
96 FLAGS_latency_recording_topic);
97 reader->SetHistoryDepth(FLAGS_latency_reader_capacity);
98 reader->Observe();
99
100 static std::string last_processed_key;
101 std::string first_key_of_current_round;
102 for (auto it = reader->Begin(); it != reader->End(); ++it) {
103 const std::string current_key =
104 absl::StrCat((*it)->module_name(), (*it)->header().sequence_num());
105 if (it == reader->Begin()) {
106 first_key_of_current_round = current_key;
107 }
108 if (current_key == last_processed_key) {
109 break;
110 }
111 UpdateStat(*it);
112 }
113 last_processed_key = first_key_of_current_round;
114
115 if (current_time - flush_time_ > FLAGS_latency_report_interval) {
116 flush_time_ = current_time;
117 if (!track_map_.empty()) {
118 PublishLatencyReport();
119 }
120 }
121}

该类的文档由以下文件生成: