move stats instrumentation to .cpp file to fix header dependency issue
This commit is contained in:
parent
70df388e6c
commit
dcd8bb6718
|
@ -83,6 +83,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/socket_io.hpp" // for print_address
|
#include "libtorrent/socket_io.hpp" // for print_address
|
||||||
#include "libtorrent/peer_connection.hpp" // for intrusive_ptr_release
|
#include "libtorrent/peer_connection.hpp" // for intrusive_ptr_release
|
||||||
|
|
||||||
|
#ifdef TORRENT_STATS
|
||||||
|
#include <fstream>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -483,18 +483,17 @@ namespace libtorrent
|
||||||
virtual buffer::interval allocate_send_buffer(int size);
|
virtual buffer::interval allocate_send_buffer(int size);
|
||||||
virtual void setup_send();
|
virtual void setup_send();
|
||||||
|
|
||||||
|
#if TORRENT_STATS
|
||||||
|
void log_buffer_usage(char* buffer, int size, char const* label);
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class Destructor>
|
template <class Destructor>
|
||||||
void append_send_buffer(char* buffer, int size, Destructor const& destructor)
|
void append_send_buffer(char* buffer, int size, Destructor const& destructor)
|
||||||
{
|
{
|
||||||
#if TORRENT_DISK_STATS
|
#if TORRENT_STATS
|
||||||
if (m_ses.m_disk_thread.is_disk_buffer(buffer))
|
log_buffer_usage(buffer, size, "queued send buffer");
|
||||||
m_ses.m_disk_thread.rename_buffer(buffer, "queued send buffer");
|
|
||||||
#endif
|
#endif
|
||||||
m_send_buffer.append_buffer(buffer, size, size, destructor);
|
m_send_buffer.append_buffer(buffer, size, size, destructor);
|
||||||
#ifdef TORRENT_STATS
|
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " append_send_buffer: " << size << std::endl;
|
|
||||||
m_ses.log_buffer_usage();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||||
|
|
|
@ -325,6 +325,17 @@ namespace libtorrent
|
||||||
std::fill(m_peer_id.begin(), m_peer_id.end(), 0);
|
std::fill(m_peer_id.begin(), m_peer_id.end(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TORRENT_STATS
|
||||||
|
void peer_connection::log_buffer_usage(char* buffer, int size, char const* label)
|
||||||
|
{
|
||||||
|
if (m_ses.m_disk_thread.is_disk_buffer(buffer))
|
||||||
|
m_ses.m_disk_thread.rename_buffer(buffer, label);
|
||||||
|
|
||||||
|
m_ses.m_buffer_usage_logger << log_time() << " append_send_buffer: " << size << std::endl;
|
||||||
|
m_ses.log_buffer_usage();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool peer_connection::unchoke_compare(boost::intrusive_ptr<peer_connection const> const& p) const
|
bool peer_connection::unchoke_compare(boost::intrusive_ptr<peer_connection const> const& p) const
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(p);
|
TORRENT_ASSERT(p);
|
||||||
|
|
Loading…
Reference in New Issue