From: Adrian Bondrescu Date: Sun, 19 Aug 2012 18:13:42 +0000 (+0300) Subject: Add counters for MPTP buffers and syscalls. X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=d8da6fc1273a2acee935a15761b77a73424faef5;p=swifty.git Add counters for MPTP buffers and syscalls. --- diff --git a/src/libswift/channel.cpp b/src/libswift/channel.cpp index e06d83f..c05ec03 100644 --- a/src/libswift/channel.cpp +++ b/src/libswift/channel.cpp @@ -27,7 +27,9 @@ tint Channel::start = now_t::now; tint Channel::epoch = now_t::now/360000000LL*360000000LL; // make logs mergeable uint64_t Channel::global_dgrams_up=0, Channel::global_dgrams_down=0, Channel::global_raw_bytes_up=0, Channel::global_raw_bytes_down=0, - Channel::global_bytes_up=0, Channel::global_bytes_down=0; + Channel::global_bytes_up=0, Channel::global_bytes_down=0, + Channel::global_buffers_up=0, Channel::global_syscalls_up=0, + Channel::global_buffers_down=0, Channel::global_syscalls_down=0; sckrwecb_t Channel::sock_open[] = {}; int Channel::sock_count = 0; swift::tint Channel::last_tick = 0; @@ -281,6 +283,8 @@ int Channel::SendTo (evutil_socket_t sock, const Address& addr, struct evbuffer for (int i=0; idests[i].bytes); global_dgrams_up+=count; + global_buffers_up+=count; + global_syscalls_up++; for (int i=0; icount; + global_buffers_down+=addr.addr->count; + global_syscalls_down++; global_raw_bytes_down+=length; Time(); return length; diff --git a/src/libswift/swift.cpp b/src/libswift/swift.cpp index 9a7bd89..4bf00b6 100644 --- a/src/libswift/swift.cpp +++ b/src/libswift/swift.cpp @@ -499,11 +499,13 @@ void ReportCallback(int fd, short event, void *arg) { if (report_progress) { fprintf(stderr, "%s %lli of %lli (seq %lli) %lli dgram %lli bytes up, " \ - "%lli dgram %lli bytes down\n", + "%lli dgram %lli bytes down mptp[send:%lli,%lli;recv:%lli,%lli]\n", IsComplete(single_fd ) ? "DONE" : "done", Complete(single_fd), Size(single_fd), SeqComplete(single_fd), Channel::global_dgrams_up, Channel::global_raw_bytes_up, - Channel::global_dgrams_down, Channel::global_raw_bytes_down ); + Channel::global_dgrams_down, Channel::global_raw_bytes_down, + Channel::global_buffers_up, Channel::global_syscalls_up, + Channel::global_buffers_down, Channel::global_syscalls_down); } FileTransfer *ft = FileTransfer::file(single_fd); diff --git a/src/libswift/swift.h b/src/libswift/swift.h index 1c5634a..67092c2 100644 --- a/src/libswift/swift.h +++ b/src/libswift/swift.h @@ -489,7 +489,8 @@ namespace swift { static MessageQueue messageQueue; static tint epoch, start; - static uint64_t global_dgrams_up, global_dgrams_down, global_raw_bytes_up, global_raw_bytes_down, global_bytes_up, global_bytes_down; + static uint64_t global_dgrams_up, global_dgrams_down, global_raw_bytes_up, global_raw_bytes_down, global_bytes_up, global_bytes_down, + global_buffers_up, global_syscalls_up, global_buffers_down, global_syscalls_down; static void CloseChannelByAddress(const Address &addr); // SOCKMGMT @@ -792,7 +793,7 @@ namespace swift { void Checkpoint(int fdes); #define MAX_QUEUE_LENGTH 1 -#define TIMER_USEC 100000 +#define TIMER_USEC 10000 class MessageQueue {