diff --git a/doc/log_stats.plot b/doc/log_stats.plot index 84fb3e93..9245c70f 100644 --- a/doc/log_stats.plot +++ b/doc/log_stats.plot @@ -17,7 +17,35 @@ gnuplot << EOF # 13) $pieces.hash.queue_size= # # log.libtorrent = mincore_stats,(cat,"/foo/mincore_stats.",(system.pid)) -# schedule = log_stats,5,10,((execute,log_rtorrent.sh,((cat,/foo/bandwidth_stats.,((system.pid)))),((system.time_seconds)),((throttle.global_up.rate)),((throttle.global_up.total)),((throttle.global_down.rate)),((throttle.global_down.total)),((throttle.unchoked_uploads)),((throttle.unchoked_downloads)),((view.size,active)),((pieces.memory.current)),((pieces.memory.sync_queue)),((pieces.memory.block_count)),((pieces.stats.total_size)),((pieces.hash.queue_size)))) +# +# schedule = log_bandwidth_stats,5,10,((execute,log_rtorrent.sh,((cat,/foo/bandwidth_stats.,((system.pid)))),((system.time_seconds)),((throttle.global_up.rate)),((throttle.global_up.total)),((throttle.global_down.rate)),((throttle.global_down.total)),((throttle.unchoked_uploads)),((throttle.unchoked_downloads)),((view.size,active)),((pieces.memory.current)),((pieces.memory.sync_queue)),((pieces.memory.block_count)),((pieces.stats.total_size)),((pieces.hash.queue_size)))) +# +# 1) system.time_seconds= +# +# 2) throttle.global_up.rate +# 3) throttle.global_up.total +# 4) throttle.global_down.rate +# 5) throttle.global_down.total +# +# 9) pieces.memory.current +# 10) pieces.memory.sync_queue +# 11) pieces.memory.block_count +# 12) pieces.stats.total_size +# 13) pieces.hash.queue_size +# +# schedule = log_bandwidth_stats,5,10,((execute,log_rtorrent.sh,((cat,/foo/bandwidth_stats.,((system.pid)))),((system.time_seconds)),((throttle.global_up.rate)),((throttle.global_up.total)),((throttle.global_down.rate)),((throttle.global_down.total)),((pieces.memory.current)),((pieces.memory.sync_queue)),((pieces.memory.block_count)),((pieces.stats.total_size)),((pieces.hash.queue_size)))) +# +# 1) system.time_seconds +# +# 2) throttle.unchoked_uploads +# 3) throttle.unchoked_downloads +# 4) network.open_sockets +# +# 5) view.size,leeching +# 6) view.size,seeding +# 7) view.size,active +# +# schedule = log_peer_stats,5,10,((execute,log_rtorrent.sh,((cat,/foo/peer_stats.,((system.pid)))),((system.time_seconds)),((throttle.unchoked_uploads)),((throttle.unchoked_downloads)),((network.open_sockets)),((view.size,leeching)),((view.size,seeding)),((view.size,active)))) set terminal png size 1024,600 @@ -56,7 +84,8 @@ plot "bandwidth_stats.$1" using 1:9 smooth bezier with lines lw 4 title 'Memory "mincore_stats.$1" using 1:8 smooth bezier with lines lw 2 title 'Sync failed /10s' axis x1y2,\ "mincore_stats.$1" using 1:11 smooth bezier with lines lw 2 title 'Alloc failed /10s' axis x1y2,\ " #include #include +#include #include #include "core/dht_manager.h" @@ -636,8 +637,8 @@ initialize_command_network() { CMD2_VAR_STRING ("protocol.choke_heuristics.down.leech", "download_leech"); CMD2_VAR_STRING ("protocol.choke_heuristics.down.seed", "download_leech"); - CMD2_ANY ("throttle.unchoked_uploads", std::bind(&torrent::currently_unchoked)); - CMD2_ANY ("throttle.unchoked_downloads", std::bind(&torrent::download_unchoked)); + CMD2_ANY ("throttle.unchoked_uploads", std::bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager())); + CMD2_ANY ("throttle.unchoked_downloads", std::bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager())); CMD2_VAR_VALUE ("throttle.min_peers.normal", 40); CMD2_VAR_VALUE ("throttle.max_peers.normal", 100); @@ -700,6 +701,7 @@ initialize_command_network() { CMD2_ANY ("network.max_open_files", std::bind(&torrent::FileManager::max_open_files, fileManager)); CMD2_ANY_VALUE_V ("network.max_open_files.set", std::bind(&torrent::FileManager::set_max_open_files, fileManager, std::placeholders::_2)); + CMD2_ANY ("network.open_sockets", std::bind(&torrent::ConnectionManager::size, cm)); CMD2_ANY ("network.max_open_sockets", std::bind(&torrent::ConnectionManager::max_size, cm)); CMD2_ANY_VALUE_V ("network.max_open_sockets.set", std::bind(&torrent::ConnectionManager::set_max_size, cm, std::placeholders::_2)); diff --git a/src/display/utils.cc b/src/display/utils.cc index c2b032e8..8daa0fe9 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -52,6 +52,7 @@ #include #include #include +#include #include "core/download.h" #include "core/manager.h" @@ -293,12 +294,12 @@ print_status_info(char* first, char* last) { char* print_status_extra(char* first, char* last) { first = print_buffer(first, last, " [U %i/%i]", - torrent::currently_unchoked(), - torrent::max_unchoked()); + torrent::resource_manager()->currently_upload_unchoked(), + torrent::resource_manager()->max_upload_unchoked()); first = print_buffer(first, last, " [D %i/%i]", - torrent::download_unchoked(), - torrent::max_download_unchoked()); + torrent::resource_manager()->currently_download_unchoked(), + torrent::resource_manager()->max_download_unchoked()); first = print_buffer(first, last, " [H %u/%u]", control->core()->http_stack()->active(), diff --git a/src/ui/root.cc b/src/ui/root.cc index 46e56760..cb905909 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -41,6 +41,7 @@ #include #include #include +#include #include "core/manager.h" #include "display/frame.h" @@ -170,7 +171,7 @@ Root::set_down_throttle(unsigned int throttle) { unsigned int global = std::max(rpc::call_command_value("throttle.max_downloads.global"), 0); if (throttle == 0 || div == 0) { - torrent::set_max_download_unchoked(global); + torrent::resource_manager()->set_max_download_unchoked(global); return; } @@ -184,9 +185,9 @@ Root::set_down_throttle(unsigned int throttle) { maxUnchoked = 10 + throttle / 5; if (global != 0) - torrent::set_max_download_unchoked(std::min(maxUnchoked, global)); + torrent::resource_manager()->set_max_download_unchoked(std::min(maxUnchoked, global)); else - torrent::set_max_download_unchoked(maxUnchoked); + torrent::resource_manager()->set_max_download_unchoked(maxUnchoked); } void @@ -200,7 +201,7 @@ Root::set_up_throttle(unsigned int throttle) { unsigned int global = std::max(rpc::call_command_value("throttle.max_uploads.global"), 0); if (throttle == 0 || div == 0) { - torrent::set_max_unchoked(global); + torrent::resource_manager()->set_max_upload_unchoked(global); return; } @@ -214,9 +215,9 @@ Root::set_up_throttle(unsigned int throttle) { maxUnchoked = 10 + throttle / 5; if (global != 0) - torrent::set_max_unchoked(std::min(maxUnchoked, global)); + torrent::resource_manager()->set_max_upload_unchoked(std::min(maxUnchoked, global)); else - torrent::set_max_unchoked(maxUnchoked); + torrent::resource_manager()->set_max_upload_unchoked(maxUnchoked); } void