Apollo 10.0
自动驾驶开放平台
main.cc 文件参考
#include <filesystem>
#include "gperftools/heap-profiler.h"
#include "gperftools/malloc_extension.h"
#include "gperftools/profiler.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.cc27 行定义.

27 {
28 // set working directory to APOLLO_RUNTIME_PATH for relative file paths
29 const char* apollo_runtime_path = std::getenv("APOLLO_RUNTIME_PATH");
30 if (apollo_runtime_path != nullptr) {
31 if (std::filesystem::is_directory(
32 std::filesystem::status(apollo_runtime_path))) {
33 std::filesystem::current_path(apollo_runtime_path);
34 }
35 }
36 google::ParseCommandLineFlags(&argc, &argv, true);
37 // Added by caros to improve dv performance
38
39 std::signal(SIGTERM, [](int sig) {
41 if (FLAGS_dv_cpu_profile) {
42 ProfilerStop();
43 }
44 if (FLAGS_dv_heap_profile) {
45 HeapProfilerDump("Befor shutdown");
46 HeapProfilerStop();
47 }
48 });
49
50 std::signal(SIGINT, [](int sig) {
52 if (FLAGS_dv_cpu_profile) {
53 ProfilerStop();
54 }
55 if (FLAGS_dv_heap_profile) {
56 HeapProfilerDump("Befor shutdown");
57 HeapProfilerStop();
58 }
59 });
60
61 if (FLAGS_dv_cpu_profile) {
62 auto base_name_cpu = std::string(argv[0]) + "_cpu" + std::string(".prof");
63 ProfilerStart(base_name_cpu.c_str());
64 }
65 if (FLAGS_dv_heap_profile) {
66 auto base_name_heap = std::string(argv[0]) + "_heap" + std::string(".prof");
67 HeapProfilerStart(base_name_heap.c_str());
68 }
69
70 apollo::cyber::GlobalData::Instance()->SetProcessGroup("dreamview_sched");
71 apollo::cyber::Init(argv[0]);
72
74 const bool init_success = dreamview.Init().ok() && dreamview.Start().ok();
75 if (!init_success) {
76 AERROR << "Failed to initialize dreamview server";
77 return -1;
78 }
80 return 0;
81}
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:89
void WaitForShutdown()
Definition state.h:50
bool Init(const char *binary_name, const std::string &dag_info)
Definition init.cc:98