X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=jam.c;fp=jam.c;h=3d11408d9e9c6c4be49a3b7ecae83718ab9988ae;hb=fca1a00f0d9b599d3ea73767f3e1ab6b0b78444a;hp=1b6aaed6cf7625462f638d86eaa9430a5212b585;hpb=f4c2815e7f939daf638b8cd388a212c9278f341c;p=jam diff --git a/jam.c b/jam.c index 1b6aaed..3d11408 100644 --- a/jam.c +++ b/jam.c @@ -377,6 +377,8 @@ int main(int argc, char **argv) // Just stay around collecting statistics until we're done. for ( ;; ) { unsigned long long sent, received; + static unsigned long long last_sent = 0, last_received = 0; + double recv_rate, send_rate; pthread_mutex_lock(&send_mutex); sent = total_bytes_sent; @@ -386,7 +388,14 @@ int main(int argc, char **argv) received = total_bytes_received; pthread_mutex_unlock(&receive_mutex); - printf("%llu %llu\n", sent, received); + send_rate = (sent - last_sent) * 8.0 / 1048576.0; + recv_rate = (received - last_received) * 8.0 / 1048576.0; + + printf("%12llu %12llu %5.0f Mbit/sec %5.0f Mbit/sec\n", sent, received, + send_rate, recv_rate); + + last_sent = sent; + last_received = received; sleep(1); }