修完bug
This commit is contained in:
@@ -33,6 +33,7 @@ asio::awaitable<void> Data_Feed_UDP_Server::_open() {
|
||||
const auto value = specific.read([](const auto& value) { return value; });
|
||||
svr.set_bind_address("0.0.0.0", value.port);
|
||||
svr.create();
|
||||
co_await svr.bind_coro();
|
||||
server_logger->c_debug({}, {}, to_string() + "开启!");
|
||||
co_return;
|
||||
}
|
||||
@@ -74,11 +75,16 @@ void BIN_Msg_Buffer::push(std::string_view msg) {
|
||||
else {
|
||||
msg_list_cache.back()->append(msg);
|
||||
}
|
||||
cache_bytes += msg.size();
|
||||
high_water_messages = std::max(high_water_messages, msg_list_cache.size());
|
||||
high_water_bytes = std::max(high_water_bytes, cache_bytes);
|
||||
}
|
||||
const std::vector<std::string*>& BIN_Msg_Buffer::get_all() {
|
||||
std::lock_guard<std::mutex> g(mtx);
|
||||
std::swap(msg_list_cache, msg_list);
|
||||
msg_list_cache.clear();
|
||||
dispatch_bytes = cache_bytes;
|
||||
cache_bytes = 0;
|
||||
mode_s_msg_num = 0;
|
||||
mode_other_msg_num = 0;
|
||||
return msg_list;
|
||||
@@ -89,15 +95,31 @@ BIN_Msg_Buffer::BIN_Msg_Buffer() {
|
||||
}
|
||||
Psc::JSON BIN_Msg_Buffer::state_json() {
|
||||
auto output_packet_size = Global::instance()->mode_acs.data_feed_config.settings.member<&Data_feed_Config_Data::packet_byte_size>().read([](const auto& value) { return value; });
|
||||
size_t size, cache_size, pool_capacity, pool_free_count;
|
||||
size_t size, cache_size, current_cache_bytes, current_dispatch_bytes, current_high_water_messages, current_high_water_bytes, pool_capacity, pool_free_count;
|
||||
{
|
||||
std::lock_guard<std::mutex> g(mtx);
|
||||
auto& pool = Global::instance()->mode_acs.data_feed_config.pool_;
|
||||
size = msg_list.size();
|
||||
cache_size = msg_list_cache.size();
|
||||
current_cache_bytes = cache_bytes;
|
||||
current_dispatch_bytes = dispatch_bytes;
|
||||
current_high_water_messages = high_water_messages;
|
||||
current_high_water_bytes = high_water_bytes;
|
||||
pool_capacity = pool.capacity();
|
||||
pool_free_count = pool.free_count();
|
||||
}
|
||||
return VAR_JSON_7(mode_s_msg_num, mode_other_msg_num, output_packet_size, cache_size, size, pool_capacity,
|
||||
pool_free_count);
|
||||
Psc::JSON ret = Psc::JSON::object();
|
||||
ret.append({"mode_s_pending", mode_s_msg_num.load()});
|
||||
ret.append({"mode_other_pending", mode_other_msg_num.load()});
|
||||
ret.append({"batch_target_bytes", output_packet_size});
|
||||
ret.append({"pending_batches", cache_size});
|
||||
ret.append({"pending_bytes", current_cache_bytes});
|
||||
ret.append({"last_dispatch_batches", size});
|
||||
ret.append({"last_dispatch_bytes", current_dispatch_bytes});
|
||||
ret.append({"high_water_batches", current_high_water_messages});
|
||||
ret.append({"high_water_bytes", current_high_water_bytes});
|
||||
ret.append({"pool_capacity", pool_capacity});
|
||||
ret.append({"pool_free_count", pool_free_count});
|
||||
ret.append({"pool_utilization_percent", pool_capacity == 0 ? 0.0 : static_cast<double>(pool_capacity - pool_free_count) * 100.0 / static_cast<double>(pool_capacity)});
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user