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 rtt;
int download_rate_peak;
int upload_rate_peak;
};
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
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
================

View File

@ -781,6 +781,11 @@ namespace libtorrent
// they sent us
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
public:
bool m_in_constructor;

View File

@ -174,6 +174,10 @@ namespace libtorrent
// estimated rtt to peer, in milliseconds
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_rtt(0)
, m_downloaded_at_last_unchoke(0)
, m_download_rate_peak(0)
, m_upload_rate_peak(0)
#ifndef NDEBUG
, m_in_constructor(true)
#endif
@ -199,6 +201,8 @@ namespace libtorrent
, m_fast_reconnect(false)
, m_rtt(0)
, m_downloaded_at_last_unchoke(0)
, m_download_rate_peak(0)
, m_upload_rate_peak(0)
#ifndef NDEBUG
, m_in_constructor(true)
#endif
@ -2202,6 +2206,8 @@ namespace libtorrent
{
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.down_speed = statistics().download_rate();
p.up_speed = statistics().upload_rate();
@ -2334,6 +2340,15 @@ namespace libtorrent
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;
// calculate the desired download queue size