提交 5635ad0a 编写于 作者: Z zhangchao19 提交者: GoLancer

framework: format and lint code for perf event

上级 b288f0a9
......@@ -29,7 +29,7 @@ namespace event {
using apollo::cybertron::base::BoundedQueue;
using apollo::cybertron::common::GlobalData;
void SchedPerfEvent::SetParams(int count, ...) {
void SchedPerfEvent::SetParams(const int count, ...) {
va_list ap;
va_start(ap, count);
event_id = va_arg(ap, int);
......@@ -43,7 +43,7 @@ void SchedPerfEvent::SetParams(int count, ...) {
va_end(ap);
}
void TransportPerfEvent::SetParams(int count, ...) {
void TransportPerfEvent::SetParams(const int count, ...) {
va_list ap;
va_start(ap, count);
event_id = va_arg(ap, int);
......
......@@ -51,20 +51,13 @@ enum class SchedPerf {
enum class TransPerf { TRANS_FROM = 1, TRANS_TO = 2, WRITE_NOTIFY = 3 };
// event_id
// 1 swap_in
// 2 swap_out
// 3 try_fetch_out
// 4 notify_in
// 5 next_routine
class PerfEventBase {
public:
int event_type = 0;
int event_id;
uint64_t t_start = -1;
uint64_t t_end = -1;
virtual void SetParams(int count, ...) {
virtual void SetParams(const int count, ...) {
va_list ap;
va_start(ap, count);
event_type = va_arg(ap, int);
......@@ -92,7 +85,7 @@ class PerfEventBase {
class SchedPerfEvent : public PerfEventBase {
public:
SchedPerfEvent() { event_type = int(EventType::SCHED_EVENT); }
void SetParams(int count, ...) override;
void SetParams(const int count, ...) override;
std::string SerializeToString() override {
std::stringstream ss;
ss << event_type << "\t";
......@@ -121,7 +114,7 @@ class SchedPerfEvent : public PerfEventBase {
class TransportPerfEvent : public PerfEventBase {
public:
TransportPerfEvent() { event_type = int(EventType::TRANS_EVENT); }
void SetParams(int count, ...) override;
void SetParams(const int count, ...) override;
std::string SerializeToString() override {
std::stringstream ss;
ss << event_type << "\t";
......
......@@ -20,7 +20,6 @@
#include <unordered_map>
#include "cybertron/event/perf_event_cache.h"
#include "cybertron/common/global_data.h"
#include "cybertron/init.h"
#include "cybertron/time/time.h"
......@@ -65,10 +64,12 @@ void PerfEventCache::AddEvent(const std::shared_ptr<PerfEventBase>& event) {
}
}
void PerfEventCache::AddSchedEvent(SchedPerf event_id, uint64_t cr_id,
int proc_id, uint64_t t_sleep,
uint64_t t_start, int try_fetch_result,
int croutine_state) {
void PerfEventCache::AddSchedEvent(const SchedPerf event_id,
const uint64_t cr_id, const int proc_id,
const uint64_t t_sleep,
const uint64_t t_start,
const int try_fetch_result,
const int croutine_state) {
if (!enable_) {
return;
}
......@@ -85,8 +86,9 @@ void PerfEventCache::AddSchedEvent(SchedPerf event_id, uint64_t cr_id,
}
}
void PerfEventCache::AddTransportEvent(TransPerf event_id, uint64_t channel_id,
uint64_t msg_seq) {
void PerfEventCache::AddTransportEvent(const TransPerf event_id,
const uint64_t channel_id,
const uint64_t msg_seq) {
if (!enable_) {
return;
}
......
......@@ -44,11 +44,12 @@ using apollo::cybertron::proto::PerfConf;
class PerfEventCache {
public:
~PerfEventCache();
void AddSchedEvent(SchedPerf event_id, uint64_t cr_id, int proc_id,
uint64_t t_sleep, uint64_t t_start, int try_fetch_result,
int croutine_state);
void AddTransportEvent(TransPerf event_id, uint64_t channel_id,
uint64_t msg_seq);
void AddSchedEvent(const SchedPerf event_id, const uint64_t cr_id,
const int proc_id, const uint64_t t_sleep,
const uint64_t t_start, const int try_fetch_result,
const int croutine_state);
void AddTransportEvent(const TransPerf event_id, const uint64_t channel_id,
const uint64_t msg_seq);
void AddEvent(const std::shared_ptr<PerfEventBase>& event);
private:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册