Apollo 11.0
自动驾驶开放平台
apollo::cyber::event::PerfEventCache类 参考

#include <perf_event_cache.h>

apollo::cyber::event::PerfEventCache 的协作图:

Public 类型

using EventBasePtr = std::shared_ptr< EventBase >
 

Public 成员函数

 ~PerfEventCache ()
 
void AddSchedEvent (const SchedPerf event_id, const uint64_t cr_id, const int proc_id, const int cr_state=-1)
 
void AddTransportEvent (const TransPerf event_id, const uint64_t channel_id, const uint64_t msg_seq, const uint64_t stamp=0, const std::string &adder="-")
 
std::string PerfFile ()
 
void Shutdown ()
 

详细描述

在文件 perf_event_cache.h 第 36 行定义.

成员类型定义说明

◆ EventBasePtr

在文件 perf_event_cache.h 第 38 行定义.

构造及析构函数说明

◆ ~PerfEventCache()

apollo::cyber::event::PerfEventCache::~PerfEventCache ( )

在文件 perf_event_cache.cc 第 50 行定义.

成员函数说明

◆ AddSchedEvent()

void apollo::cyber::event::PerfEventCache::AddSchedEvent ( const SchedPerf  event_id,
const uint64_t  cr_id,
const int  proc_id,
const int  cr_state = -1 
)

在文件 perf_event_cache.cc 第 68 行定义.

70 {
71 if (!enable_) {
72 return;
73 }
74
75 if (perf_conf_.type() != PerfType::SCHED &&
76 perf_conf_.type() != PerfType::ALL) {
77 return;
78 }
79
80 EventBasePtr e = std::make_shared<SchedEvent>();
81 e->set_eid(static_cast<int>(event_id));
82 e->set_stamp(Time::Now().ToNanosecond());
83 e->set_cr_state(cr_state);
84 e->set_cr_id(cr_id);
85 e->set_proc_id(proc_id);
86
87 event_queue_.Enqueue(e);
88}
static Time Now()
get the current time.
Definition time.cc:57
bool Enqueue(const T &element)
std::shared_ptr< EventBase > EventBasePtr

◆ AddTransportEvent()

void apollo::cyber::event::PerfEventCache::AddTransportEvent ( const TransPerf  event_id,
const uint64_t  channel_id,
const uint64_t  msg_seq,
const uint64_t  stamp = 0,
const std::string &  adder = "-" 
)

在文件 perf_event_cache.cc 第 90 行定义.

94 {
95 if (!enable_) {
96 return;
97 }
98
99 if (perf_conf_.type() != PerfType::TRANSPORT &&
100 perf_conf_.type() != PerfType::ALL) {
101 return;
102 }
103
104 EventBasePtr e = std::make_shared<TransportEvent>();
105 e->set_eid(static_cast<int>(event_id));
106 e->set_channel_id(channel_id);
107 e->set_msg_seq(msg_seq);
108 e->set_adder(adder);
109 auto t = stamp;
110 if (stamp == 0) {
111 t = Time::Now().ToNanosecond();
112 }
113 e->set_stamp(t);
114
115 event_queue_.Enqueue(e);
116}
uint64_t ToNanosecond() const
convert time to nanosecond.
Definition time.cc:83

◆ PerfFile()

std::string apollo::cyber::event::PerfEventCache::PerfFile ( )
inline

在文件 perf_event_cache.h 第 47 行定义.

47{ return perf_file_; }

◆ Shutdown()

void apollo::cyber::event::PerfEventCache::Shutdown ( )

在文件 perf_event_cache.cc 第 52 行定义.

52 {
53 if (!enable_) {
54 return;
55 }
56
57 shutdown_ = true;
58 event_queue_.BreakAllWait();
59 if (io_thread_.joinable()) {
60 io_thread_.join();
61 }
62
63 of_ << cyber::Time::Now().ToNanosecond() << std::endl;
64 of_.flush();
65 of_.close();
66}

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