added more bandwidth monitoring of DHT and TCP/IP overhead. added monitoring of the running DHT lookups

This commit is contained in:
Arvid Norberg
2008-09-20 17:42:25 +00:00
parent 98f9d5826c
commit 0338510b9b
22 changed files with 472 additions and 274 deletions

View File

@@ -159,6 +159,7 @@ bool print_log = false;
bool print_downloads = false;
bool print_piece_bar = false;
bool print_file_progress = false;
bool show_dht_status = false;
bool sequential_download = false;
bool print_ip = true;
@@ -1186,6 +1187,7 @@ int main(int ac, char* av[])
if (c == 'd') print_downloads = !print_downloads;
if (c == 'f') print_file_progress = !print_file_progress;
if (c == 'a') print_piece_bar = !print_piece_bar;
if (c == 'g') show_dht_status = !show_dht_status;
// toggle columns
if (c == '1') print_ip = !print_ip;
if (c == '2') print_as = !print_as;
@@ -1229,7 +1231,7 @@ int main(int ac, char* av[])
std::stringstream out;
out << "[q] quit [i] toggle peers [d] toggle downloading pieces [p] toggle paused "
"[a] toggle piece bar [s] toggle download sequential [f] toggle files "
"[j] force recheck [space] toggle session pause [c] clear error [v] scrape\n"
"[j] force recheck [space] toggle session pause [c] clear error [v] scrape [g] show DHT\n"
"[1] toggle IP [2] toggle AS [3] toggle timers [4] toggle block progress "
"[5] toggle peer rate [6] toggle failures [7] toggle send buffers\n";
@@ -1360,10 +1362,16 @@ int main(int ac, char* av[])
out << "==== conns: " << sess_stat.num_peers
<< " down: " << esc("32") << add_suffix(sess_stat.download_rate) << "/s" << esc("0")
<< " (" << esc("32") << add_suffix(sess_stat.total_download) << esc("0") << ") "
" up: " << esc("31") << add_suffix(sess_stat.upload_rate) << "/s " << esc("0")
<< " (" << esc("32") << add_suffix(sess_stat.total_download) << esc("0") << ")"
" up: " << esc("31") << add_suffix(sess_stat.upload_rate) << "/s" << esc("0")
<< " (" << esc("31") << add_suffix(sess_stat.total_upload) << esc("0") << ")"
" waste: " << add_suffix(sess_stat.total_redundant_bytes)
" tcp/ip: "
<< esc("32") << add_suffix(sess_stat.ip_overhead_download_rate) << "/s" << esc("0") << " "
<< esc("31") << add_suffix(sess_stat.ip_overhead_upload_rate) << "/s" << esc("0")
<< " DHT: "
<< esc("32") << add_suffix(sess_stat.dht_download_rate) << "/s" << esc("0") << " "
<< esc("31") << add_suffix(sess_stat.dht_upload_rate) << "/s" << esc("0") << " ====\n"
"==== waste: " << add_suffix(sess_stat.total_redundant_bytes)
<< " fail: " << add_suffix(sess_stat.total_failed_bytes)
<< " unchoked: " << sess_stat.num_unchoked << " / " << sess_stat.allowed_upload_slots
<< " bw queues: (" << sess_stat.up_bandwidth_queue
@@ -1374,6 +1382,20 @@ int main(int ac, char* av[])
<< " (" << add_suffix(cs.read_cache_size * 16 * 1024) << ")"
" ====" << std::endl;
if (show_dht_status)
{
out << "DHT nodes: " << sess_stat.dht_nodes
<< " DHT cached nodes: " << sess_stat.dht_node_cache
<< " total DHT size: " << sess_stat.dht_global_nodes << std::endl;
for (std::vector<dht_lookup>::iterator i = sess_stat.active_requests.begin()
, end(sess_stat.active_requests.end()); i != end; ++i)
{
out << " " << i->type << " " << i->outstanding_requests << " ("
<< i->branch_factor << ") ( timeouts "
<< i->timeouts << " responses " << i->responses << ")\n";
}
}
if (active_handle.is_valid())
{
torrent_handle h = active_handle;