From f1d5f09dd86dfbbe34b8d915f150d68ed779f146 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C4=83zvan=20Crainea?= Date: Sat, 2 Jun 2012 15:02:52 +0300 Subject: [PATCH] sendfile: added timer for client --- sendfile/client/client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sendfile/client/client.c b/sendfile/client/client.c index 572f9cd..f5d93be 100644 --- a/sendfile/client/client.c +++ b/sendfile/client/client.c @@ -5,8 +5,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -22,6 +24,8 @@ int main(int argc, char **argv) { int fd[MAX_NUMBER_OF_PEERS]; int peers[MAX_NUMBER_OF_PEERS]; int i = 0, total, sent_size; + struct timeval start; + struct timeval stop; if (argc < 4 || argc % 2) { printf("Usage: %s " @@ -82,6 +86,7 @@ int main(int argc, char **argv) { total = i; + gettimeofday(&start, NULL); do { sent_size = 0; @@ -94,6 +99,10 @@ int main(int argc, char **argv) { usleep(20); } } while(sent_size); + gettimeofday(&stop, NULL); + + printf("Successfully written %s in %ld seconds\n", file_name, + stop.tv_sec - start.tv_sec); return 0; } -- 2.20.1