mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Improve overlay stats (#1242)
This commit is contained in:
parent
f94d1bee0c
commit
8364a2425f
8 changed files with 180 additions and 105 deletions
|
@ -574,28 +574,40 @@ void OverlayImpl::update_peer_err_ctr(adnl::AdnlNodeIdShort peer_id, bool is_fec
|
|||
}
|
||||
}
|
||||
|
||||
void OverlayImpl::update_throughput_out_ctr(adnl::AdnlNodeIdShort peer_id, td::uint32 msg_size, bool is_query) {
|
||||
void OverlayImpl::update_throughput_out_ctr(adnl::AdnlNodeIdShort peer_id, td::uint64 msg_size, bool is_query,
|
||||
bool is_response) {
|
||||
auto out_peer = peer_list_.peers_.get(peer_id);
|
||||
if (out_peer) {
|
||||
out_peer->throughput_out_bytes_ctr += msg_size;
|
||||
out_peer->throughput_out_packets_ctr++;
|
||||
|
||||
out_peer->traffic_ctr.add_packet(msg_size, false);
|
||||
if (is_response) {
|
||||
out_peer->traffic_responses_ctr.add_packet(msg_size, false);
|
||||
}
|
||||
if (is_query) {
|
||||
out_peer->last_out_query_at = td::Timestamp::now();
|
||||
}
|
||||
}
|
||||
total_traffic_ctr.add_packet(msg_size, false);
|
||||
if (is_response) {
|
||||
total_traffic_responses_ctr.add_packet(msg_size, false);
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayImpl::update_throughput_in_ctr(adnl::AdnlNodeIdShort peer_id, td::uint32 msg_size, bool is_query) {
|
||||
void OverlayImpl::update_throughput_in_ctr(adnl::AdnlNodeIdShort peer_id, td::uint64 msg_size, bool is_query,
|
||||
bool is_response) {
|
||||
auto in_peer = peer_list_.peers_.get(peer_id);
|
||||
if (in_peer) {
|
||||
in_peer->throughput_in_bytes_ctr += msg_size;
|
||||
in_peer->throughput_in_packets_ctr++;
|
||||
|
||||
in_peer->traffic_ctr.add_packet(msg_size, true);
|
||||
if (is_response) {
|
||||
in_peer->traffic_responses_ctr.add_packet(msg_size, true);
|
||||
}
|
||||
if (is_query) {
|
||||
in_peer->last_in_query_at = td::Timestamp::now();
|
||||
}
|
||||
}
|
||||
total_traffic_ctr.add_packet(msg_size, true);
|
||||
if (is_response) {
|
||||
total_traffic_responses_ctr.add_packet(msg_size, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayImpl::update_peer_ip_str(adnl::AdnlNodeIdShort peer_id, td::string ip_str) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue