Skip to content

Commit

Permalink
Remove (annoying) data_logger for network throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
billaue2 committed Jul 3, 2017
1 parent d4152c4 commit 160144d
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 344 deletions.
2 changes: 0 additions & 2 deletions contrib/epee/include/net/abstract_tcp_server2.inl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "../../../../src/cryptonote_core/cryptonote_core.h" // e.g. for the send_stop_signal()

#include "../../../../contrib/otshell_utils/utils.hpp"
#include "../../../../src/p2p/data_logger.hpp"
using namespace nOT::nUtils; // TODO

#define CONNECTION_CLEANUP_TIME 30 // seconds
Expand Down Expand Up @@ -306,7 +305,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
delay *= 0.5;
if (delay > 0) {
long int ms = (long int)(delay * 100);
epee::net_utils::data_logger::get_instance().add_data("sleep_down", ms);
boost::this_thread::sleep_for(boost::chrono::milliseconds(ms));
}
} while(delay > 0);
Expand Down
4 changes: 0 additions & 4 deletions src/cryptonote_protocol/cryptonote_protocol_handler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "profile_tools.h"
#include "../../contrib/otshell_utils/utils.hpp"
#include "../../src/p2p/network_throttle-detail.hpp"
#include "../../src/p2p/data_logger.hpp"
using namespace nOT::nUtils;

namespace cryptonote
Expand Down Expand Up @@ -914,9 +913,6 @@ namespace cryptonote
TIME_MEASURE_FINISH(block_process_time);
LOG_PRINT_CCONTEXT_L2("Block process time: " << block_process_time + transactions_process_time << "(" << transactions_process_time << "/" << block_process_time << ")ms");

epee::net_utils::data_logger::get_instance().add_data("calc_time", block_process_time + transactions_process_time);
epee::net_utils::data_logger::get_instance().add_data("block_processing", 1);

} // each download block
m_core.cleanup_handle_incoming_blocks();

Expand Down
21 changes: 2 additions & 19 deletions src/p2p/connection_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#include "../../contrib/epee/include/net/abstract_tcp_server2.h"

#include "../../contrib/otshell_utils/utils.hpp"
#include "data_logger.hpp"
using namespace nOT::nUtils;

// TODO:
Expand Down Expand Up @@ -220,18 +219,6 @@ uint64_t connection_basic::get_rate_down_limit() {

void connection_basic::save_limit_to_file(int limit) {
// saving limit to file
if (!epee::net_utils::data_logger::m_save_graph)
return;

{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
epee::net_utils::data_logger::get_instance().add_data("upload_limit", network_throttle_manager::get_global_throttle_out().get_target_speed() / 1024);
}

{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_in );
epee::net_utils::data_logger::get_instance().add_data("download_limit", network_throttle_manager::get_global_throttle_in().get_target_speed() / 1024);
}
}

void connection_basic::set_tos_flag(int tos) {
Expand Down Expand Up @@ -261,7 +248,6 @@ void connection_basic::sleep_before_packet(size_t packet_size, int phase, int q
long int ms = (long int)(delay * 1000);
_info_c("net/sleep", "Sleeping in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<packet_size); // debug sleep
_dbg1("sleep in sleep_before_packet");
epee::net_utils::data_logger::get_instance().add_data("sleep_up", ms);
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
}
} while(delay > 0);
Expand Down Expand Up @@ -292,13 +278,11 @@ void connection_basic::do_send_handler_write_from_queue( const boost::system::er
}

void connection_basic::logger_handle_net_read(size_t size) { // network data read
size /= 1024;
epee::net_utils::data_logger::get_instance().add_data("download", size);

}

void connection_basic::logger_handle_net_write(size_t size) {
size /= 1024;
epee::net_utils::data_logger::get_instance().add_data("upload", size);

}

double connection_basic::get_sleep_time(size_t cb) {
Expand All @@ -308,7 +292,6 @@ double connection_basic::get_sleep_time(size_t cb) {
}

void connection_basic::set_save_graph(bool save_graph) {
epee::net_utils::data_logger::m_save_graph = save_graph;
}


Expand Down
202 changes: 0 additions & 202 deletions src/p2p/data_logger.cpp

This file was deleted.

Loading

0 comments on commit 160144d

Please sign in to comment.