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

Method log_client_states

implementation/endpoints/src/endpoint_manager_impl.cpp:1113–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113void endpoint_manager_impl::log_client_states() const {
1114 std::stringstream its_log;
1115 client_endpoints_t its_client_endpoints;
1116 std::vector<std::pair<std::tuple<boost::asio::ip::address, uint16_t, bool>, size_t>> its_client_queue_sizes;
1117
1118 {
1119 std::scoped_lock its_lock(endpoint_mutex_);
1120 its_client_endpoints = client_endpoints_;
1121 }
1122
1123 for (const auto& its_address : its_client_endpoints) {
1124 for (const auto& its_port : its_address.second) {
1125 for (const auto& its_reliability : its_port.second) {
1126 for (const auto& its_partition : its_reliability.second) {
1127 size_t its_queue_size = its_partition.second->get_queue_size();
1128 if (its_queue_size > VSOMEIP_DEFAULT_QUEUE_WARN_SIZE)
1129 its_client_queue_sizes.push_back(
1130 std::make_pair(std::make_tuple(its_address.first, its_port.first, its_reliability.first), its_queue_size));
1131 }
1132 }
1133 }
1134 }
1135
1136 std::sort(its_client_queue_sizes.begin(), its_client_queue_sizes.end(),
1137 [](const std::pair<std::tuple<boost::asio::ip::address, uint16_t, bool>, size_t>& _a,
1138 const std::pair<std::tuple<boost::asio::ip::address, uint16_t, bool>, size_t>& _b) { return (_a.second > _b.second); });
1139
1140 // NOTE: limit is important, do *NOT* want an arbitrarily big string!
1141 size_t its_max(std::min(size_t(5), its_client_queue_sizes.size()));
1142 for (size_t i = 0; i < its_max; i++) {
1143 its_log << std::get<0>(its_client_queue_sizes[i].first).to_string() << ":" << std::get<1>(its_client_queue_sizes[i].first) << "("
1144 << (std::get<2>(its_client_queue_sizes[i].first) ? "tcp" : "udp") << "):" << its_client_queue_sizes[i].second;
1145 if (i < its_max - 1)
1146 its_log << ", ";
1147 }
1148
1149 if (its_log.str().length() > 0)
1150 VSOMEIP_INFO << "ECQ: " << its_client_queue_sizes.size() << " [" << its_log.str() << "]";
1151}
1152
1153void endpoint_manager_impl::log_server_states() const {
1154 std::stringstream its_log;

Callers 1

version_log_timer_cbkMethod · 0.45

Calls 5

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

Tested by

no test coverage detected