Apollo 9.0
自动驾驶开放平台
main.cc 文件参考
#include "gperftools/profiler.h"
#include "gperftools/heap-profiler.h"
#include "gperftools/malloc_extension.h"
#include "cyber/common/global_data.h"
#include "cyber/init.h"
#include "modules/dreamview_plus/backend/dreamview.h"
main.cc 的引用(Include)关系图:

浏览源代码.

函数

int main (int argc, char *argv[])
 

函数说明

◆ main()

int main ( int  argc,
char *  argv[] 
)

在文件 main.cc 第 25 行定义.

25 {
26 google::ParseCommandLineFlags(&argc, &argv, true);
27 // Added by caros to improve dv performance
28
29 std::signal(SIGTERM, [](int sig){
31 if (FLAGS_dv_cpu_profile) {
32 ProfilerStop();
33 }
34 if (FLAGS_dv_heap_profile) {
35 HeapProfilerDump("Befor shutdown");
36 HeapProfilerStop();
37 }
38 });
39
40 std::signal(SIGINT, [](int sig){
42 if (FLAGS_dv_cpu_profile) {
43 ProfilerStop();
44 }
45 if (FLAGS_dv_heap_profile) {
46 HeapProfilerDump("Befor shutdown");
47 HeapProfilerStop();
48 }
49 });
50
51 if (FLAGS_dv_cpu_profile) {
52 auto base_name_cpu = std::string(argv[0]) + "_cpu" + std::string(".prof");
53 ProfilerStart(base_name_cpu.c_str());
54 }
55 if (FLAGS_dv_heap_profile) {
56 auto base_name_heap = std::string(argv[0]) + "_heap" + std::string(".prof");
57 HeapProfilerStart(base_name_heap.c_str());
58 }
59
60 apollo::cyber::GlobalData::Instance()->SetProcessGroup("dreamview_sched");
61 apollo::cyber::Init(argv[0]);
62
64 const bool init_success = dreamview.Init().ok() && dreamview.Start().ok();
65 if (!init_success) {
66 AERROR << "Failed to initialize dreamview server";
67 return -1;
68 }
70 return 0;
71}
bool ok() const
check whether the return status is OK.
Definition status.h:67
apollo::common::Status Init()
Definition dreamview.cc:54
apollo::common::Status Start()
Definition dreamview.cc:124
#define AERROR
Definition log.h:44
void OnShutdown(int sig)
Definition init.cc:90
void WaitForShutdown()
Definition state.h:50
bool Init(const char *binary_name, const std::string &dag_info)
Definition init.cc:99