diff --git a/include/libtorrent/stat.hpp b/include/libtorrent/stat.hpp index 9bf05d36c..8f91d0d6e 100644 --- a/include/libtorrent/stat.hpp +++ b/include/libtorrent/stat.hpp @@ -55,25 +55,6 @@ namespace libtorrent public: enum { history = 5 }; -#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING - -#define PRINT_SIZEOF(x) l << "sizeof(" #x "): " << sizeof(x) << "\n"; -#define PRINT_OFFSETOF(x, y) l << " offsetof(" #x "," #y "): " << offsetof(x, y) << "\n"; - - static void print_size(logger& l) - { - PRINT_SIZEOF(stat_channel) - PRINT_OFFSETOF(stat_channel, m_rate_history) - PRINT_OFFSETOF(stat_channel, m_window) - PRINT_OFFSETOF(stat_channel, m_counter) - PRINT_OFFSETOF(stat_channel, m_total_counter) - PRINT_OFFSETOF(stat_channel, m_rate_sum) - } -#undef PRINT_SIZEOF -#undef PRINT_OFFSETOF - -#endif - stat_channel() : m_window(3) , m_counter(0) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index a8b937d3f..2c1a80418 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -77,12 +77,18 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/peer_info.hpp" #include "libtorrent/settings.hpp" +#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING +#endif + #ifndef TORRENT_WINDOWS #include #endif #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING +// for logging stat layout +#include "libtorrent/stat.hpp" + // for logging the size of DHT structures #ifndef TORRENT_DISABLE_DHT #include @@ -618,7 +624,14 @@ namespace aux { PRINT_SIZEOF(stat) PRINT_SIZEOF(bandwidth_channel) PRINT_SIZEOF(policy) - stat_channel::print_size(*m_logger); + + PRINT_SIZEOF(stat_channel) + PRINT_OFFSETOF(stat_channel, m_rate_history) + PRINT_OFFSETOF(stat_channel, m_window) + PRINT_OFFSETOF(stat_channel, m_counter) + PRINT_OFFSETOF(stat_channel, m_total_counter) + PRINT_OFFSETOF(stat_channel, m_rate_sum) + torrent::print_size(*m_logger); PRINT_SIZEOF(peer_connection)