made session stats config build
This commit is contained in:
@@ -77,6 +77,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "libtorrent/enum_net.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/utf8.hpp"
|
||||
#include "libtorrent/upnp.hpp"
|
||||
#include "libtorrent/natpmp.hpp"
|
||||
#include "libtorrent/lsd.hpp"
|
||||
|
||||
#ifndef TORRENT_WINDOWS
|
||||
#include <sys/resource.h>
|
||||
@@ -978,6 +981,14 @@ namespace aux {
|
||||
m_key = key;
|
||||
}
|
||||
|
||||
void session_impl::unchoke_peer(peer_connection& c)
|
||||
{
|
||||
torrent* t = c.associated_torrent().lock().get();
|
||||
TORRENT_ASSERT(t);
|
||||
if (t->unchoke_peer(c))
|
||||
++m_num_unchoked;
|
||||
}
|
||||
|
||||
int session_impl::next_port()
|
||||
{
|
||||
std::pair<int, int> const& out_ports = m_settings.outgoing_ports;
|
||||
@@ -2633,6 +2644,25 @@ namespace aux {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
void session_impl::log_buffer_usage()
|
||||
{
|
||||
int send_buffer_capacity = 0;
|
||||
int used_send_buffer = 0;
|
||||
for (connection_map::const_iterator i = m_connections.begin()
|
||||
, end(m_connections.end()); i != end; ++i)
|
||||
{
|
||||
send_buffer_capacity += (*i)->send_buffer_capacity();
|
||||
used_send_buffer += (*i)->send_buffer_size();
|
||||
}
|
||||
TORRENT_ASSERT(send_buffer_capacity >= used_send_buffer);
|
||||
m_buffer_usage_logger << log_time() << " send_buffer_size: " << send_buffer_capacity << std::endl;
|
||||
m_buffer_usage_logger << log_time() << " used_send_buffer: " << used_send_buffer << std::endl;
|
||||
m_buffer_usage_logger << log_time() << " send_buffer_utilization: "
|
||||
<< (used_send_buffer * 100.f / send_buffer_capacity) << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
void session_impl::free_buffer(char* buf, int size)
|
||||
{
|
||||
TORRENT_ASSERT(size > 0);
|
||||
|
Reference in New Issue
Block a user