内存优化

This commit is contained in:
2026-08-28 11:49:06 +08:00
parent e26f7eb52f
commit fa1e7e24fc
21 changed files with 722 additions and 237 deletions
+7 -4
View File
@@ -65,6 +65,8 @@ Global::Global() : Config() {
SSR::mode_s_logger = new BaseLogger("@/logs/mode_s", MB * size_MB * 10, piece_num);
dsp_logger = new BaseLogger("@/logs/dsp", MB * size_MB, piece_num);
server_logger = new BaseLogger("@/logs/server", MB * size_MB, piece_num);
SSR::parse_pos_call_back = nullptr;
SSR::parse_ok_json = nullptr;
asio_socket::socket_logger->set_redirect([](const BaseLogger::Log_Info& log_info) {
auto msg = "[" + std::string("func") + "~" + log_info.func_pattern + "] " + log_info.log_type.to_string() +
log_info.content;
@@ -77,9 +79,7 @@ Global::Global() : Config() {
});
from_base_json(&j);
#ifdef Cache_Some_Mode_S
auto old_parse_ok_json = SSR::parse_ok_json;
SSR::parse_ok_json = [old_parse_ok_json](Aircraft_Info* aircraft_info, SSR::P_S mode_s_msg, Psc::JSON json) {
old_parse_ok_json(aircraft_info, mode_s_msg, json);
SSR::parse_ok_json = [](Aircraft_Info* aircraft_info, SSR::P_S mode_s_msg, Psc::JSON) {
auto f = static_cast<Aircraft*>(aircraft_info);
f->add_msg_limit(mode_s_msg);
};
@@ -88,7 +88,10 @@ Global::Global() : Config() {
auto src = std::dynamic_pointer_cast<Data_Source>(msg->source);
Mode_S_Statistic_Data* ss = &src->mode_s_statistic;
ss->add_cpr_error(t, err_type);
SSR::mode_s_logger->debug("CPR/" + to_string(t) + "/" + to_string(err_type), {}, log);
if (err_type == SSR::CPR_Ret_Type::Speed_Error || err_type == SSR::CPR_Ret_Type::Inter_Error ||
err_type == SSR::CPR_Ret_Type::Time_Space_Too_Long ||
err_type == SSR::CPR_Ret_Type::Out_of_Maximum_Detection_Range)
SSR::mode_s_logger->debug("CPR/" + to_string(t) + "/" + to_string(err_type), {}, log);
};
// 处理错误
SSR::parse_call_back = [this](SSR::Parse_Call_Back_Type type, SSR::Aircraft_Info* info, std::string_view field_name,