remove option TORRENT_DISABLE_FULL_STATS
This commit is contained in:
parent
ce9ff9885b
commit
3db32f67b5
3
Jamfile
3
Jamfile
|
@ -341,9 +341,6 @@ feature.compose <iconv>off : <define>TORRENT_USE_ICONV=0 ;
|
||||||
feature valgrind : off on : composite propagated link-incompatible ;
|
feature valgrind : off on : composite propagated link-incompatible ;
|
||||||
feature.compose <valgrind>on : <define>TORRENT_USE_VALGRIND=1 ;
|
feature.compose <valgrind>on : <define>TORRENT_USE_VALGRIND=1 ;
|
||||||
|
|
||||||
feature full-stats : on off : composite propagated link-incompatible ;
|
|
||||||
feature.compose <full-stats>off : <define>TORRENT_DISABLE_FULL_STATS ;
|
|
||||||
|
|
||||||
feature memory-optimization : off on : composite propagated link-incompatible ;
|
feature memory-optimization : off on : composite propagated link-incompatible ;
|
||||||
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;
|
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ def consume_ifdef(lno, lines, warn_on_ifdefs = False):
|
||||||
|
|
||||||
if verbose: print 'prep %s' % l
|
if verbose: print 'prep %s' % l
|
||||||
|
|
||||||
if warn_on_ifdefs and ('TORRENT_DEBUG' in l or 'TORRENT_DISABLE_FULL_STATS' in l):
|
if warn_on_ifdefs and ('TORRENT_DEBUG' in l):
|
||||||
while l.endswith('\\'):
|
while l.endswith('\\'):
|
||||||
lno += 1
|
lno += 1
|
||||||
l += lines[lno].strip()
|
l += lines[lno].strip()
|
||||||
|
|
|
@ -185,15 +185,6 @@ For all available options, see the `building libtorrent`_ secion.
|
||||||
|
|
||||||
.. _`building libtorrent`: building.html
|
.. _`building libtorrent`: building.html
|
||||||
|
|
||||||
reduce statistics
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
You can save some memory for each connection and each torrent by reducing the
|
|
||||||
number of separate rates kept track of by libtorrent. If you build with ``full-stats=off``
|
|
||||||
(or ``-DTORRENT_DISABLE_FULL_STATS``) you will save a few hundred bytes for each
|
|
||||||
connection and torrent. It might make a difference if you have a very large number
|
|
||||||
of peers or torrents.
|
|
||||||
|
|
||||||
play nice with the disk
|
play nice with the disk
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
|
|
@ -121,23 +121,14 @@ namespace libtorrent
|
||||||
|
|
||||||
void sent_syn(bool ipv6)
|
void sent_syn(bool ipv6)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40);
|
m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40);
|
||||||
#else
|
|
||||||
m_stat[upload_protocol].add(ipv6 ? 60 : 40);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void received_synack(bool ipv6)
|
void received_synack(bool ipv6)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
// we received SYN-ACK and also sent ACK back
|
// we received SYN-ACK and also sent ACK back
|
||||||
m_stat[download_ip_protocol].add(ipv6 ? 60 : 40);
|
m_stat[download_ip_protocol].add(ipv6 ? 60 : 40);
|
||||||
m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40);
|
m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40);
|
||||||
#else
|
|
||||||
m_stat[download_protocol].add(ipv6 ? 60 : 40);
|
|
||||||
m_stat[upload_protocol].add(ipv6 ? 60 : 40);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void received_bytes(int bytes_payload, int bytes_protocol)
|
void received_bytes(int bytes_payload, int bytes_protocol)
|
||||||
|
@ -170,22 +161,12 @@ namespace libtorrent
|
||||||
const int mtu = 1500;
|
const int mtu = 1500;
|
||||||
const int packet_size = mtu - header;
|
const int packet_size = mtu - header;
|
||||||
const int overhead = (std::max)(1, (bytes_transferred + packet_size - 1) / packet_size) * header;
|
const int overhead = (std::max)(1, (bytes_transferred + packet_size - 1) / packet_size) * header;
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
m_stat[download_ip_protocol].add(overhead);
|
m_stat[download_ip_protocol].add(overhead);
|
||||||
m_stat[upload_ip_protocol].add(overhead);
|
m_stat[upload_ip_protocol].add(overhead);
|
||||||
#else
|
|
||||||
m_stat[download_protocol].add(overhead);
|
|
||||||
m_stat[upload_protocol].add(overhead);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
int upload_ip_overhead() const { return m_stat[upload_ip_protocol].counter(); }
|
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 download_ip_overhead() const { return m_stat[download_ip_protocol].counter(); }
|
||||||
#else
|
|
||||||
int upload_ip_overhead() const { return 0; }
|
|
||||||
int download_ip_overhead() const { return 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// should be called once every second
|
// should be called once every second
|
||||||
void second_tick(int tick_interval_ms)
|
void second_tick(int tick_interval_ms)
|
||||||
|
@ -198,60 +179,42 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
return m_stat[upload_payload].low_pass_rate()
|
return m_stat[upload_payload].low_pass_rate()
|
||||||
+ m_stat[upload_protocol].low_pass_rate()
|
+ m_stat[upload_protocol].low_pass_rate()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[upload_ip_protocol].low_pass_rate();
|
||||||
+ m_stat[upload_ip_protocol].low_pass_rate()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int low_pass_download_rate() const
|
int low_pass_download_rate() const
|
||||||
{
|
{
|
||||||
return m_stat[download_payload].low_pass_rate()
|
return m_stat[download_payload].low_pass_rate()
|
||||||
+ m_stat[download_protocol].low_pass_rate()
|
+ m_stat[download_protocol].low_pass_rate()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[download_ip_protocol].low_pass_rate();
|
||||||
+ m_stat[download_ip_protocol].low_pass_rate()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int upload_rate() const
|
int upload_rate() const
|
||||||
{
|
{
|
||||||
return m_stat[upload_payload].rate()
|
return m_stat[upload_payload].rate()
|
||||||
+ m_stat[upload_protocol].rate()
|
+ m_stat[upload_protocol].rate()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[upload_ip_protocol].rate();
|
||||||
+ m_stat[upload_ip_protocol].rate()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int download_rate() const
|
int download_rate() const
|
||||||
{
|
{
|
||||||
return m_stat[download_payload].rate()
|
return m_stat[download_payload].rate()
|
||||||
+ m_stat[download_protocol].rate()
|
+ m_stat[download_protocol].rate()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[download_ip_protocol].rate();
|
||||||
+ m_stat[download_ip_protocol].rate()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type total_upload() const
|
size_type total_upload() const
|
||||||
{
|
{
|
||||||
return m_stat[upload_payload].total()
|
return m_stat[upload_payload].total()
|
||||||
+ m_stat[upload_protocol].total()
|
+ m_stat[upload_protocol].total()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[upload_ip_protocol].total();
|
||||||
+ m_stat[upload_ip_protocol].total()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type total_download() const
|
size_type total_download() const
|
||||||
{
|
{
|
||||||
return m_stat[download_payload].total()
|
return m_stat[download_payload].total()
|
||||||
+ m_stat[download_protocol].total()
|
+ m_stat[download_protocol].total()
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
+ m_stat[download_ip_protocol].total();
|
||||||
+ m_stat[download_ip_protocol].total()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int upload_payload_rate() const
|
int upload_payload_rate() const
|
||||||
|
@ -299,10 +262,8 @@ namespace libtorrent
|
||||||
upload_protocol,
|
upload_protocol,
|
||||||
download_payload,
|
download_payload,
|
||||||
download_protocol,
|
download_protocol,
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
upload_ip_protocol,
|
upload_ip_protocol,
|
||||||
download_ip_protocol,
|
download_ip_protocol,
|
||||||
#endif
|
|
||||||
num_channels
|
num_channels
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -394,16 +394,8 @@ namespace libtorrent {
|
||||||
: torrent_alert(h)
|
: torrent_alert(h)
|
||||||
, interval(in)
|
, interval(in)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
for (int i = 0; i < num_channels; ++i)
|
for (int i = 0; i < num_channels; ++i)
|
||||||
transferred[i] = s[i].counter();
|
transferred[i] = s[i].counter();
|
||||||
#else
|
|
||||||
const int len = download_protocol + 1;
|
|
||||||
for (int i = 0; i < download_protocol + 1; ++i)
|
|
||||||
transferred[i] = s[i].counter();
|
|
||||||
for (int i = len; i < num_channels; ++i)
|
|
||||||
transferred[i] = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string stats_alert::message() const
|
std::string stats_alert::message() const
|
||||||
|
|
|
@ -5389,19 +5389,11 @@ retry:
|
||||||
s.payload_upload_rate = m_stat.transfer_rate(stat::upload_payload);
|
s.payload_upload_rate = m_stat.transfer_rate(stat::upload_payload);
|
||||||
s.total_payload_upload = m_stat.total_transfer(stat::upload_payload);
|
s.total_payload_upload = m_stat.total_transfer(stat::upload_payload);
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_FULL_STATS
|
|
||||||
// IP-overhead
|
// IP-overhead
|
||||||
s.ip_overhead_download_rate = m_stat.transfer_rate(stat::download_ip_protocol);
|
s.ip_overhead_download_rate = m_stat.transfer_rate(stat::download_ip_protocol);
|
||||||
s.total_ip_overhead_download = m_stat.total_transfer(stat::download_ip_protocol);
|
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.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);
|
s.total_ip_overhead_upload = m_stat.total_transfer(stat::upload_ip_protocol);
|
||||||
#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;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// tracker
|
// tracker
|
||||||
s.total_tracker_download = m_stats_counters[counters::recv_tracker_bytes];
|
s.total_tracker_download = m_stats_counters[counters::recv_tracker_bytes];
|
||||||
|
|
|
@ -177,7 +177,6 @@ namespace libtorrent
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 3 replace this with performance counters. remove depedency on session_impl
|
|
||||||
void tracker_connection::sent_bytes(int bytes)
|
void tracker_connection::sent_bytes(int bytes)
|
||||||
{
|
{
|
||||||
m_man.sent_bytes(bytes);
|
m_man.sent_bytes(bytes);
|
||||||
|
|
Loading…
Reference in New Issue