add stats counter for the number of outstanding async_accept calls

This commit is contained in:
arvidn 2018-11-28 01:54:22 +01:00 committed by Arvid Norberg
parent cc49a7fb15
commit 35ec87af4f
4 changed files with 12 additions and 0 deletions

View File

@ -465,6 +465,8 @@ namespace libtorrent {
num_utp_close_wait,
num_utp_deleted,
num_outstanding_accept,
num_counters,
num_gauges_counters = num_counters - num_stats_counters
};

View File

@ -2533,6 +2533,7 @@ namespace aux {
#endif
std::weak_ptr<tcp::acceptor> ls(listener);
m_stats_counters.inc_stats_counter(counters::num_outstanding_accept);
listener->async_accept(*str, [this, c, ls, ssl] (error_code const& ec)
{ return this->wrap(&session_impl::on_accept_connection, c, ls, ec, ssl); });
}
@ -2543,6 +2544,8 @@ namespace aux {
{
COMPLETE_ASYNC("session_impl::on_accept_connection");
m_stats_counters.inc_stats_counter(counters::on_accept_counter);
m_stats_counters.inc_stats_counter(counters::num_outstanding_accept, -1);
TORRENT_ASSERT(is_single_thread());
std::shared_ptr<tcp::acceptor> listener = listen_socket.lock();
if (!listener) return;

View File

@ -252,6 +252,10 @@ namespace {
// the number of allowed unchoked peers
METRIC(ses, num_unchoke_slots)
// the number of listen sockets that are currently accepting incoming
// connections
METRIC(ses, num_outstanding_accept)
// bittorrent message counters. These counters are incremented
// every time a message of the corresponding type is received from
// or sent to a bittorrent peer.

View File

@ -624,6 +624,9 @@ reports = [
'picker.piece_picker_rand_loops', \
'picker.piece_picker_busy_loops' \
], {'type': stacked}),
('async_accept', 'number of outstanding accept calls', '', '', [ \
'ses.num_outstanding_accept' \
]),
# ('picker_full_partials_distribution', 'full pieces', '', '', ['num full partial pieces'],
# {'type': histogram, 'binwidth': 5, 'numbins': 120}),