added peak rates to peer_info

This commit is contained in:
Arvid Norberg 2008-04-03 06:11:21 +00:00
parent 77f9278a36
commit 0fcb204128
4 changed files with 31 additions and 0 deletions

View File

@ -2365,6 +2365,10 @@ It contains the following fields::
int receive_quota; int receive_quota;
int rtt; int rtt;
int download_rate_peak;
int upload_rate_peak;
}; };
The ``flags`` attribute tells you in which state the peer is. It is set to The ``flags`` attribute tells you in which state the peer is. It is set to
@ -2567,6 +2571,9 @@ from the bandwidth manager.
``rtt`` is an estimated round trip time to this peer, in milliseconds. It is ``rtt`` is an estimated round trip time to this peer, in milliseconds. It is
estimated by timing the the tcp ``connect()``. It may be 0 for incoming connections. estimated by timing the the tcp ``connect()``. It may be 0 for incoming connections.
``download_rate_peak`` and ``upload_rate_peak`` are the highest download and upload
rates seen on this connection. They are given in bytes per second. This number is
reset to 0 on reconnect.
session_settings session_settings
================ ================

View File

@ -781,6 +781,11 @@ namespace libtorrent
// they sent us // they sent us
size_type m_downloaded_at_last_unchoke; size_type m_downloaded_at_last_unchoke;
// max transfer rates seen on this peer
int m_download_rate_peak;
int m_upload_rate_peak;
#ifndef NDEBUG #ifndef NDEBUG
public: public:
bool m_in_constructor; bool m_in_constructor;

View File

@ -174,6 +174,10 @@ namespace libtorrent
// estimated rtt to peer, in milliseconds // estimated rtt to peer, in milliseconds
int rtt; int rtt;
// the highest transfer rates seen for this peer
int download_rate_peak;
int upload_rate_peak;
}; };
} }

View File

@ -120,6 +120,8 @@ namespace libtorrent
, m_fast_reconnect(false) , m_fast_reconnect(false)
, m_rtt(0) , m_rtt(0)
, m_downloaded_at_last_unchoke(0) , m_downloaded_at_last_unchoke(0)
, m_download_rate_peak(0)
, m_upload_rate_peak(0)
#ifndef NDEBUG #ifndef NDEBUG
, m_in_constructor(true) , m_in_constructor(true)
#endif #endif
@ -199,6 +201,8 @@ namespace libtorrent
, m_fast_reconnect(false) , m_fast_reconnect(false)
, m_rtt(0) , m_rtt(0)
, m_downloaded_at_last_unchoke(0) , m_downloaded_at_last_unchoke(0)
, m_download_rate_peak(0)
, m_upload_rate_peak(0)
#ifndef NDEBUG #ifndef NDEBUG
, m_in_constructor(true) , m_in_constructor(true)
#endif #endif
@ -2202,6 +2206,8 @@ namespace libtorrent
{ {
TORRENT_ASSERT(!associated_torrent().expired()); TORRENT_ASSERT(!associated_torrent().expired());
p.download_rate_peak = m_download_rate_peak;
p.upload_rate_peak = m_upload_rate_peak;
p.rtt = m_rtt; p.rtt = m_rtt;
p.down_speed = statistics().download_rate(); p.down_speed = statistics().download_rate();
p.up_speed = statistics().upload_rate(); p.up_speed = statistics().upload_rate();
@ -2334,6 +2340,15 @@ namespace libtorrent
m_statistics.second_tick(tick_interval); m_statistics.second_tick(tick_interval);
if (m_statistics.upload_payload_rate() > m_upload_rate_peak)
{
m_upload_rate_peak = m_statistics.upload_payload_rate();
}
if (m_statistics.download_payload_rate() > m_download_rate_peak)
{
m_download_rate_peak = m_statistics.download_payload_rate();
}
if (!t->valid_metadata()) return; if (!t->valid_metadata()) return;
// calculate the desired download queue size // calculate the desired download queue size