remove debug logging to print field offsets and struct sizes

This commit is contained in:
Arvid Norberg
2013-12-02 10:00:03 +00:00
parent 356332a93b
commit a05103154b
15 changed files with 6 additions and 412 deletions

View File

@@ -415,7 +415,8 @@ namespace libtorrent
void session::set_log_path(std::string const& p)
{
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING \
|| defined TORRENT_ERROR_LOGGING
m_impl->set_log_path(p);
#endif
}

View File

@@ -99,7 +99,6 @@ POSSIBILITY OF SUCH DAMAGE.
// for logging stat layout
#include "libtorrent/stat.hpp"
#include "libtorrent/struct_debug.hpp"
// for logging the size of DHT structures
#ifndef TORRENT_DISABLE_DHT
@@ -871,184 +870,7 @@ namespace aux {
, LIBTORRENT_REVISION);
(*m_logger) << tmp;
logger& l = *m_logger;
int temp = 0;
int prev_size = 0;
PRINT_SIZEOF(announce_entry)
PRINT_OFFSETOF(announce_entry, url)
PRINT_OFFSETOF(announce_entry, trackerid)
PRINT_OFFSETOF(announce_entry, message)
PRINT_OFFSETOF(announce_entry, last_error)
PRINT_OFFSETOF(announce_entry, next_announce)
PRINT_OFFSETOF(announce_entry, min_announce)
PRINT_OFFSETOF(announce_entry, tier)
PRINT_OFFSETOF(announce_entry, fail_limit)
PRINT_OFFSETOF_END(announce_entry)
PRINT_SIZEOF(torrent_info)
PRINT_OFFSETOF(torrent_info, m_refs)
PRINT_OFFSETOF(torrent_info, m_merkle_first_leaf)
PRINT_OFFSETOF(torrent_info, m_files)
PRINT_OFFSETOF(torrent_info, m_orig_files)
PRINT_OFFSETOF(torrent_info, m_urls)
PRINT_OFFSETOF(torrent_info, m_web_seeds)
PRINT_OFFSETOF(torrent_info, m_nodes)
PRINT_OFFSETOF(torrent_info, m_merkle_tree)
PRINT_OFFSETOF(torrent_info, m_info_section)
PRINT_OFFSETOF(torrent_info, m_piece_hashes)
PRINT_OFFSETOF(torrent_info, m_comment)
PRINT_OFFSETOF(torrent_info, m_created_by)
PRINT_OFFSETOF(torrent_info, m_info_dict)
PRINT_OFFSETOF(torrent_info, m_creation_date)
PRINT_OFFSETOF(torrent_info, m_info_hash)
PRINT_OFFSETOF_END(torrent_info)
PRINT_SIZEOF(union_endpoint)
PRINT_SIZEOF(request_callback)
PRINT_SIZEOF(stat)
PRINT_SIZEOF(bandwidth_channel)
PRINT_SIZEOF(policy)
(*m_logger) << "sizeof(utp_socket_impl): " << socket_impl_size() << "\n";
PRINT_SIZEOF(file_entry)
PRINT_SIZEOF(internal_file_entry)
PRINT_OFFSETOF(internal_file_entry, name)
PRINT_OFFSETOF(internal_file_entry, path_index)
PRINT_OFFSETOF_END(internal_file_entry)
PRINT_SIZEOF(file_storage)
PRINT_OFFSETOF(file_storage, m_files)
PRINT_OFFSETOF(file_storage, m_file_hashes)
PRINT_OFFSETOF(file_storage, m_symlinks)
PRINT_OFFSETOF(file_storage, m_mtime)
PRINT_OFFSETOF(file_storage, m_file_base)
PRINT_OFFSETOF(file_storage, m_paths)
PRINT_OFFSETOF(file_storage, m_name)
PRINT_OFFSETOF(file_storage, m_total_size)
PRINT_OFFSETOF(file_storage, m_num_pieces)
PRINT_OFFSETOF(file_storage, m_piece_length)
PRINT_OFFSETOF_END(file_storage)
// PRINT_SIZEOF(stat_channel)
// PRINT_OFFSETOF(stat_channel, m_counter)
// PRINT_OFFSETOF(stat_channel, m_average)
// PRINT_OFFSETOF(stat_channel, m_total_counter)
torrent::print_size(*m_logger);
PRINT_SIZEOF(peer_connection)
PRINT_SIZEOF(bt_peer_connection)
PRINT_SIZEOF(address)
PRINT_SIZEOF(address_v4)
PRINT_SIZEOF(address_v4::bytes_type)
#if TORRENT_USE_IPV6
PRINT_SIZEOF(address_v6)
PRINT_SIZEOF(address_v6::bytes_type)
#endif
PRINT_SIZEOF(void*)
#ifndef TORRENT_DISABLE_DHT
PRINT_SIZEOF(dht::node_entry)
#endif
PRINT_SIZEOF(policy::peer)
PRINT_OFFSETOF(policy::peer, prev_amount_upload)
PRINT_OFFSETOF(policy::peer, prev_amount_download)
PRINT_OFFSETOF(policy::peer, connection)
#ifndef TORRENT_DISABLE_GEO_IP
#ifdef TORRENT_DEBUG
PRINT_OFFSETOF(policy::peer, inet_as_num)
#endif
PRINT_OFFSETOF(policy::peer, inet_as)
#endif
PRINT_OFFSETOF(policy::peer, last_optimistically_unchoked)
PRINT_OFFSETOF(policy::peer, last_connected)
PRINT_OFFSETOF(policy::peer, port)
PRINT_OFFSETOF(policy::peer, upload_rate_limit)
PRINT_OFFSETOF(policy::peer, download_rate_limit)
PRINT_OFFSETOF(policy::peer, hashfails)
PRINT_OFFSETOF_END(policy::peer)
PRINT_SIZEOF(policy::ipv4_peer)
#if TORRENT_USE_IPV6
PRINT_SIZEOF(policy::ipv6_peer)
#endif
PRINT_SIZEOF(udp_socket)
PRINT_OFFSETOF(udp_socket, m_ipv4_sock)
PRINT_OFFSETOF(udp_socket, m_buf)
#if TORRENT_USE_IPV6
PRINT_OFFSETOF(udp_socket, m_ipv6_sock)
#endif
PRINT_OFFSETOF(udp_socket, m_bind_port)
PRINT_OFFSETOF(udp_socket, m_v4_outstanding)
#if TORRENT_USE_IPV6
PRINT_OFFSETOF(udp_socket, m_v6_outstanding)
#endif
PRINT_OFFSETOF(udp_socket, m_socks5_sock)
PRINT_OFFSETOF(udp_socket, m_connection_ticket)
PRINT_OFFSETOF(udp_socket, m_proxy_settings)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_socket, m_cc)
#endif
PRINT_OFFSETOF(udp_socket, m_resolver)
PRINT_OFFSETOF(udp_socket, m_tmp_buf)
PRINT_OFFSETOF(udp_socket, m_queue_packets)
PRINT_OFFSETOF(udp_socket, m_tunnel_packets)
PRINT_OFFSETOF(udp_socket, m_abort)
PRINT_OFFSETOF(udp_socket, m_proxy_addr)
PRINT_OFFSETOF(udp_socket, m_queue)
PRINT_OFFSETOF(udp_socket, m_outstanding_ops)
#ifdef TORRENT_DEBUG
PRINT_OFFSETOF(udp_socket, m_started)
PRINT_OFFSETOF(udp_socket, m_magic)
PRINT_OFFSETOF(udp_socket, m_outstanding_when_aborted)
#endif
PRINT_OFFSETOF_END(udp_socket)
PRINT_SIZEOF(tracker_connection)
PRINT_SIZEOF(http_tracker_connection)
PRINT_SIZEOF(udp_tracker_connection)
PRINT_OFFSETOF(udp_tracker_connection, m_refs)
PRINT_OFFSETOF(udp_tracker_connection, m_start_time)
PRINT_OFFSETOF(udp_tracker_connection, m_read_time)
PRINT_OFFSETOF(udp_tracker_connection, m_timeout)
PRINT_OFFSETOF(udp_tracker_connection, m_completion_timeout)
PRINT_OFFSETOF(udp_tracker_connection, m_read_timeout)
PRINT_OFFSETOF(udp_tracker_connection, m_mutex)
PRINT_OFFSETOF(udp_tracker_connection, m_requester)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_tracker_connection, m_man)
#endif
PRINT_OFFSETOF(udp_tracker_connection, m_req)
PRINT_OFFSETOF(udp_tracker_connection, m_abort)
PRINT_OFFSETOF(udp_tracker_connection, m_hostname)
PRINT_OFFSETOF(udp_tracker_connection, m_target)
PRINT_OFFSETOF(udp_tracker_connection, m_endpoints)
PRINT_OFFSETOF(udp_tracker_connection, m_transaction_id)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_tracker_connection, m_ses)
#endif
PRINT_OFFSETOF(udp_tracker_connection, m_attempts)
PRINT_OFFSETOF(udp_tracker_connection, m_state)
PRINT_OFFSETOF(udp_tracker_connection, m_proxy)
PRINT_OFFSETOF_END(udp_tracker_connection)
#ifndef TORRENT_DISABLE_DHT
PRINT_SIZEOF(dht::find_data_observer)
PRINT_SIZEOF(dht::announce_observer)
PRINT_SIZEOF(dht::null_observer)
#endif
#undef PRINT_OFFSETOF_END
#undef PRINT_OFFSETOF
#undef PRINT_SIZEOF
#endif
#endif // TORRENT_VERBOSE_LOGGING
#ifdef TORRENT_STATS

View File

@@ -87,10 +87,6 @@ POSSIBILITY OF SUCH DAMAGE.
#endif // BOOST_VERSION
#endif // TORRENT_USE_OPENSSL
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
#include "libtorrent/struct_debug.hpp"
#endif
using namespace libtorrent;
using boost::tuples::tuple;
using boost::tuples::get;
@@ -204,117 +200,6 @@ namespace
namespace libtorrent
{
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
void torrent::print_size(logger& l)
{
char tmp[300];
int temp = 0;
int prev_size = 0;
PRINT_SIZEOF(torrent)
PRINT_OFFSETOF(torrent, m_tracker_address)
PRINT_OFFSETOF(torrent, m_manager)
PRINT_OFFSETOF(torrent, m_policy)
PRINT_OFFSETOF(torrent, m_total_uploaded)
PRINT_OFFSETOF(torrent, m_total_downloaded)
PRINT_OFFSETOF(torrent, m_started)
PRINT_OFFSETOF(torrent, m_torrent_file)
PRINT_OFFSETOF(torrent, m_owning_storage)
PRINT_OFFSETOF(torrent, m_storage)
PRINT_OFFSETOF(torrent, m_connections)
PRINT_OFFSETOF(torrent, m_web_seeds)
#ifndef TORRENT_DISABLE_EXTENSIONS
PRINT_OFFSETOF(torrent, m_extensions)
#endif
PRINT_OFFSETOF(torrent, m_tracker_timer)
PRINT_OFFSETOF(torrent, m_stat)
// some compilers don't like using offsetof on references it seems
#ifndef _MSC_VER
PRINT_OFFSETOF(torrent, m_ses)
#endif
PRINT_OFFSETOF(torrent, m_file_priority)
PRINT_OFFSETOF(torrent, m_file_progress)
PRINT_OFFSETOF(torrent, m_picker)
PRINT_OFFSETOF(torrent, m_trackers)
PRINT_OFFSETOF(torrent, m_time_critical_pieces)
PRINT_OFFSETOF(torrent, m_username)
PRINT_OFFSETOF(torrent, m_password)
PRINT_OFFSETOF(torrent, m_net_interfaces)
PRINT_OFFSETOF(torrent, m_save_path)
PRINT_OFFSETOF(torrent, m_url)
PRINT_OFFSETOF(torrent, m_uuid)
PRINT_OFFSETOF(torrent, m_source_feed_url)
PRINT_OFFSETOF(torrent, m_torrent_file_buf)
PRINT_OFFSETOF(torrent, m_verified)
PRINT_OFFSETOF(torrent, m_error)
PRINT_OFFSETOF(torrent, m_error_file)
PRINT_OFFSETOF(torrent, m_resume_data)
PRINT_OFFSETOF(torrent, m_resume_entry)
PRINT_OFFSETOF(torrent, m_name)
PRINT_OFFSETOF(torrent, m_storage_constructor)
PRINT_OFFSETOF(torrent, m_added_time)
PRINT_OFFSETOF(torrent, m_completed_time)
PRINT_OFFSETOF(torrent, m_last_saved_resume)
PRINT_OFFSETOF(torrent, m_last_seen_complete)
PRINT_OFFSETOF(torrent, m_swarm_last_seen_complete)
PRINT_OFFSETOF(torrent, m_num_verified)
#ifndef TORRENT_DISABLE_ENCRYPTION
PRINT_OFFSETOF(torrent, m_obfuscated_hash)
#endif
PRINT_OFFSETOF(torrent, m_ratio)
PRINT_OFFSETOF(torrent, m_available_free_upload)
PRINT_OFFSETOF(torrent, m_average_piece_time)
PRINT_OFFSETOF(torrent, m_piece_time_deviation)
PRINT_OFFSETOF(torrent, m_total_failed_bytes)
PRINT_OFFSETOF(torrent, m_total_redundant_bytes)
// PRINT_OFFSETOF(torrent, m_upload_mode_time:24)
// PRINT_OFFSETOF(torrent, m_state:3)
// PRINT_OFFSETOF(torrent, m_storage_mode:2)
// PRINT_OFFSETOF(torrent, m_announcing:1)
// PRINT_OFFSETOF(torrent, m_waiting_tracker:1)
// PRINT_OFFSETOF(torrent, m_seed_mode:1)
// PRINT_OFFSETOF(torrent, m_active_time:24)
PRINT_OFFSETOF(torrent, m_last_working_tracker)
// PRINT_OFFSETOF(torrent, m_finished_time:24)
// PRINT_OFFSETOF(torrent, m_sequential_download:1)
// PRINT_OFFSETOF(torrent, m_got_tracker_response:1)
// PRINT_OFFSETOF(torrent, m_connections_initialized:1)
// PRINT_OFFSETOF(torrent, m_super_seeding:1)
// PRINT_OFFSETOF(torrent, m_override_resume_data:1)
// PRINT_OFFSETOF(torrent, m_resolving_country:1)
// PRINT_OFFSETOF(torrent, m_resolve_countries:1)
// PRINT_OFFSETOF(torrent, m_need_save_resume_data:1)
// PRINT_OFFSETOF(torrent, m_seeding_time:24)
PRINT_OFFSETOF(torrent, m_time_scaler)
// PRINT_OFFSETOF(torrent, m_max_uploads:24)
// PRINT_OFFSETOF(torrent, m_num_uploads:24)
// PRINT_OFFSETOF(torrent, m_block_size_shift:5)
// PRINT_OFFSETOF(torrent, m_has_incoming:1)
// PRINT_OFFSETOF(torrent, m_files_checked:1)
// PRINT_OFFSETOF(torrent, m_queued_for_checking:1)
// PRINT_OFFSETOF(torrent, m_max_connections:24)
// PRINT_OFFSETOF(torrent, m_padding:24)
PRINT_OFFSETOF(torrent, m_sequence_number)
// PRINT_OFFSETOF(torrent, m_complete:24)
// PRINT_OFFSETOF(torrent, m_priority)
// PRINT_OFFSETOF(torrent, m_incomplete:24)
// PRINT_OFFSETOF(torrent, m_progress_ppm:20)
// PRINT_OFFSETOF(torrent, m_abort:1)
// PRINT_OFFSETOF(torrent, m_announce_to_dht:1)
// PRINT_OFFSETOF(torrent, m_announce_to_trackers:1)
// PRINT_OFFSETOF(torrent, m_announce_to_lsd:1)
// PRINT_OFFSETOF(torrent, m_allow_peers:1)
// PRINT_OFFSETOF(torrent, m_upload_mode:1)
// PRINT_OFFSETOF(torrent, m_auto_managed:1)
// PRINT_OFFSETOF(torrent, m_last_scrape)
}
#undef PRINT_SIZEOF
#undef PRINT_OFFSETOF
#endif
int root2(int x)
{
int ret = 0;