move DHT transfer counters to performance_counters
This commit is contained in:
parent
7249122329
commit
ce9ff9885b
|
@ -227,6 +227,8 @@ namespace libtorrent
|
|||
dht_get_out,
|
||||
dht_put_in,
|
||||
dht_put_out,
|
||||
sent_dht_bytes,
|
||||
recv_dht_bytes,
|
||||
|
||||
// uTP counters
|
||||
utp_packet_loss,
|
||||
|
|
|
@ -140,26 +140,6 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
void received_dht_bytes(int bytes)
|
||||
{
|
||||
TORRENT_ASSERT(bytes >= 0);
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
m_stat[download_dht_protocol].add(bytes);
|
||||
#else
|
||||
m_stat[download_protocol].add(bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
void sent_dht_bytes(int bytes)
|
||||
{
|
||||
TORRENT_ASSERT(bytes >= 0);
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
m_stat[upload_dht_protocol].add(bytes);
|
||||
#else
|
||||
m_stat[upload_protocol].add(bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
void received_bytes(int bytes_payload, int bytes_protocol)
|
||||
{
|
||||
TORRENT_ASSERT(bytes_payload >= 0);
|
||||
|
@ -202,13 +182,9 @@ namespace libtorrent
|
|||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
int upload_ip_overhead() const { return m_stat[upload_ip_protocol].counter(); }
|
||||
int download_ip_overhead() const { return m_stat[download_ip_protocol].counter(); }
|
||||
int upload_dht() const { return m_stat[upload_dht_protocol].counter(); }
|
||||
int download_dht() const { return m_stat[download_dht_protocol].counter(); }
|
||||
#else
|
||||
int upload_ip_overhead() const { return 0; }
|
||||
int download_ip_overhead() const { return 0; }
|
||||
int upload_dht() const { return 0; }
|
||||
int download_dht() const { return 0; }
|
||||
#endif
|
||||
|
||||
// should be called once every second
|
||||
|
@ -224,7 +200,6 @@ namespace libtorrent
|
|||
+ m_stat[upload_protocol].low_pass_rate()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[upload_ip_protocol].low_pass_rate()
|
||||
+ m_stat[upload_dht_protocol].low_pass_rate()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -235,7 +210,6 @@ namespace libtorrent
|
|||
+ m_stat[download_protocol].low_pass_rate()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[download_ip_protocol].low_pass_rate()
|
||||
+ m_stat[download_dht_protocol].low_pass_rate()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -246,7 +220,6 @@ namespace libtorrent
|
|||
+ m_stat[upload_protocol].rate()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[upload_ip_protocol].rate()
|
||||
+ m_stat[upload_dht_protocol].rate()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -257,7 +230,6 @@ namespace libtorrent
|
|||
+ m_stat[download_protocol].rate()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[download_ip_protocol].rate()
|
||||
+ m_stat[download_dht_protocol].rate()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -268,7 +240,6 @@ namespace libtorrent
|
|||
+ m_stat[upload_protocol].total()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[upload_ip_protocol].total()
|
||||
+ m_stat[upload_dht_protocol].total()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -279,7 +250,6 @@ namespace libtorrent
|
|||
+ m_stat[download_protocol].total()
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
+ m_stat[download_ip_protocol].total()
|
||||
+ m_stat[download_dht_protocol].total()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -331,9 +301,7 @@ namespace libtorrent
|
|||
download_protocol,
|
||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
||||
upload_ip_protocol,
|
||||
upload_dht_protocol,
|
||||
download_ip_protocol,
|
||||
download_dht_protocol,
|
||||
#endif
|
||||
num_channels
|
||||
};
|
||||
|
|
|
@ -3003,13 +3003,13 @@ retry:
|
|||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
int dht_down = 0;
|
||||
int dht_up = 0;
|
||||
if (m_dht)
|
||||
{
|
||||
int dht_down;
|
||||
int dht_up;
|
||||
m_dht->network_stats(dht_up, dht_down);
|
||||
m_stat.sent_dht_bytes(dht_up);
|
||||
m_stat.received_dht_bytes(dht_down);
|
||||
m_stats_counters.inc_stats_counter(counters::sent_dht_bytes, dht_up);
|
||||
m_stats_counters.inc_stats_counter(counters::recv_dht_bytes, dht_down);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3019,11 +3019,8 @@ retry:
|
|||
peer_class* gpc = m_classes.at(m_global_class);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
gpc->channel[peer_connection::download_channel].use_quota(m_stat.download_dht());
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
gpc->channel[peer_connection::upload_channel].use_quota(m_stat.upload_dht());
|
||||
gpc->channel[peer_connection::download_channel].use_quota(dht_down);
|
||||
gpc->channel[peer_connection::upload_channel].use_quota(dht_up);
|
||||
#endif
|
||||
|
||||
int up_limit = upload_rate_limit(m_global_class);
|
||||
|
@ -5398,41 +5395,27 @@ retry:
|
|||
s.total_ip_overhead_download = m_stat.total_transfer(stat::download_ip_protocol);
|
||||
s.ip_overhead_upload_rate = m_stat.transfer_rate(stat::upload_ip_protocol);
|
||||
s.total_ip_overhead_upload = m_stat.total_transfer(stat::upload_ip_protocol);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// DHT protocol
|
||||
s.dht_download_rate = m_stat.transfer_rate(stat::download_dht_protocol);
|
||||
s.total_dht_download = m_stat.total_transfer(stat::download_dht_protocol);
|
||||
s.dht_upload_rate = m_stat.transfer_rate(stat::upload_dht_protocol);
|
||||
s.total_dht_upload = m_stat.total_transfer(stat::upload_dht_protocol);
|
||||
#else
|
||||
s.dht_download_rate = 0;
|
||||
s.total_dht_download = 0;
|
||||
s.dht_upload_rate = 0;
|
||||
s.total_dht_upload = 0;
|
||||
#endif // TORRENT_DISABLE_DHT
|
||||
|
||||
#else
|
||||
// IP-overhead
|
||||
s.ip_overhead_download_rate = 0;
|
||||
s.total_ip_overhead_download = 0;
|
||||
s.ip_overhead_upload_rate = 0;
|
||||
s.total_ip_overhead_upload = 0;
|
||||
|
||||
// DHT protocol
|
||||
s.dht_download_rate = 0;
|
||||
s.total_dht_download = 0;
|
||||
s.dht_upload_rate = 0;
|
||||
s.total_dht_upload = 0;
|
||||
#endif
|
||||
|
||||
// tracker
|
||||
s.total_tracker_download = m_stats_counters[counters::recv_tracker_bytes];
|
||||
s.total_tracker_upload = m_stats_counters[counters::sent_tracker_bytes];
|
||||
|
||||
// dht
|
||||
s.total_dht_download = m_stats_counters[counters::recv_dht_bytes];
|
||||
s.total_dht_upload = m_stats_counters[counters::sent_dht_bytes];
|
||||
|
||||
// deprecated
|
||||
s.tracker_download_rate = 0;
|
||||
s.tracker_upload_rate = 0;
|
||||
s.dht_download_rate = 0;
|
||||
s.dht_upload_rate = 0;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
if (m_dht)
|
||||
|
|
|
@ -416,6 +416,10 @@ namespace libtorrent
|
|||
METRIC(dht, dht_put_in)
|
||||
METRIC(dht, dht_put_out)
|
||||
|
||||
// the number of bytes sent and received by the DHT
|
||||
METRIC(dht, sent_dht_bytes)
|
||||
METRIC(dht, recv_dht_bytes)
|
||||
|
||||
// uTP counters. Each counter represents the number of time each event
|
||||
// has occurred.
|
||||
METRIC(utp, utp_packet_loss)
|
||||
|
|
Loading…
Reference in New Issue