forked from premiere/premiere-libtorrent
fix builds for all combinations of stats and disk stats
This commit is contained in:
parent
ca20d2d600
commit
3bc40b9980
|
@ -717,9 +717,11 @@ namespace libtorrent
|
||||||
void check_invariant() const;
|
void check_invariant() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
void log_buffer_usage();
|
void log_buffer_usage();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined TORRENT_STATS
|
||||||
// logger used to write bandwidth usage statistics
|
// logger used to write bandwidth usage statistics
|
||||||
std::ofstream m_stats_logger;
|
std::ofstream m_stats_logger;
|
||||||
int m_second_counter;
|
int m_second_counter;
|
||||||
|
|
|
@ -499,14 +499,14 @@ 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
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
void log_buffer_usage(char* buffer, int size, char const* label);
|
void log_buffer_usage(char* buffer, int size, char const* label);
|
||||||
#endif
|
#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_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
log_buffer_usage(buffer, size, "queued send buffer");
|
log_buffer_usage(buffer, size, "queued send buffer");
|
||||||
#endif
|
#endif
|
||||||
m_send_buffer.append_buffer(buffer, size, size, destructor);
|
m_send_buffer.append_buffer(buffer, size, size, destructor);
|
||||||
|
|
|
@ -329,7 +329,7 @@ namespace libtorrent
|
||||||
std::fill(m_peer_id.begin(), m_peer_id.end(), 0);
|
std::fill(m_peer_id.begin(), m_peer_id.end(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
void peer_connection::log_buffer_usage(char* buffer, int size, char const* label)
|
void peer_connection::log_buffer_usage(char* buffer, int size, char const* label)
|
||||||
{
|
{
|
||||||
if (m_ses.m_disk_thread.is_disk_buffer(buffer))
|
if (m_ses.m_disk_thread.is_disk_buffer(buffer))
|
||||||
|
@ -4321,7 +4321,7 @@ namespace libtorrent
|
||||||
m_send_buffer.append(buf, free_space);
|
m_send_buffer.append(buf, free_space);
|
||||||
size -= free_space;
|
size -= free_space;
|
||||||
buf += free_space;
|
buf += free_space;
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " send_buffer: "
|
m_ses.m_buffer_usage_logger << log_time() << " send_buffer: "
|
||||||
<< free_space << std::endl;
|
<< free_space << std::endl;
|
||||||
m_ses.log_buffer_usage();
|
m_ses.log_buffer_usage();
|
||||||
|
@ -4339,7 +4339,7 @@ namespace libtorrent
|
||||||
std::memcpy(buffer.first, buf, size);
|
std::memcpy(buffer.first, buf, size);
|
||||||
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
||||||
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " send_buffer_alloc: " << size << std::endl;
|
m_ses.m_buffer_usage_logger << log_time() << " send_buffer_alloc: " << size << std::endl;
|
||||||
m_ses.log_buffer_usage();
|
m_ses.log_buffer_usage();
|
||||||
#endif
|
#endif
|
||||||
|
@ -4364,7 +4364,7 @@ namespace libtorrent
|
||||||
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
||||||
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
||||||
buffer::interval ret(buffer.first, buffer.first + size);
|
buffer::interval ret(buffer.first, buffer.first + size);
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer_alloc: " << size << std::endl;
|
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer_alloc: " << size << std::endl;
|
||||||
m_ses.log_buffer_usage();
|
m_ses.log_buffer_usage();
|
||||||
#endif
|
#endif
|
||||||
|
@ -4372,7 +4372,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer: " << size << std::endl;
|
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer: " << size << std::endl;
|
||||||
m_ses.log_buffer_usage();
|
m_ses.log_buffer_usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3395,7 +3395,7 @@ namespace aux {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
void session_impl::log_buffer_usage()
|
void session_impl::log_buffer_usage()
|
||||||
{
|
{
|
||||||
int send_buffer_capacity = 0;
|
int send_buffer_capacity = 0;
|
||||||
|
|
Loading…
Reference in New Issue