MCPcopy Create free account
hub / github.com/COVESA/vsomeip / log_server_states

Method log_server_states

implementation/endpoints/src/endpoint_manager_impl.cpp:1153–1187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1151}
1152
1153void endpoint_manager_impl::log_server_states() const {
1154 std::stringstream its_log;
1155 server_endpoints_t its_server_endpoints;
1156 std::vector<std::pair<std::pair<uint16_t, bool>, size_t>> its_client_queue_sizes;
1157
1158 {
1159 std::scoped_lock its_lock(endpoint_mutex_);
1160 its_server_endpoints = server_endpoints_;
1161 }
1162
1163 for (const auto& its_port : its_server_endpoints) {
1164 for (const auto& its_reliability : its_port.second) {
1165 size_t its_queue_size = its_reliability.second->get_queue_size();
1166 if (its_queue_size > VSOMEIP_DEFAULT_QUEUE_WARN_SIZE)
1167 its_client_queue_sizes.push_back(std::make_pair(std::make_pair(its_port.first, its_reliability.first), its_queue_size));
1168 }
1169 }
1170
1171 std::sort(its_client_queue_sizes.begin(), its_client_queue_sizes.end(),
1172 [](const std::pair<std::pair<uint16_t, bool>, size_t>& _a, const std::pair<std::pair<uint16_t, bool>, size_t>& _b) {
1173 return (_a.second > _b.second);
1174 });
1175
1176 // NOTE: limit is important, do *NOT* want an arbitrarily big string!
1177 size_t its_max(std::min(size_t(5), its_client_queue_sizes.size()));
1178 for (size_t i = 0; i < its_max; i++) {
1179 its_log << its_client_queue_sizes[i].first.first << "(" << (its_client_queue_sizes[i].first.second ? "tcp" : "udp")
1180 << "):" << its_client_queue_sizes[i].second;
1181 if (i < its_max - 1)
1182 its_log << ", ";
1183 }
1184
1185 if (its_log.str().length() > 0)
1186 VSOMEIP_INFO << "ESQ: " << its_client_queue_sizes.size() << " [" << its_log.str() << "]";
1187}
1188
1189void endpoint_manager_impl::add_multicast_option(const multicast_option_t& _option) {
1190

Callers 1

version_log_timer_cbkMethod · 0.80

Calls 4

beginMethod · 0.80
endMethod · 0.80
get_queue_sizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected