From aea3bceeb16e553ff75a2f28c7f44f04b81513d7 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 08 Dec 2014 20:11:04 +0000
Subject: [PATCH] timing code
---
src/server.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/server.c b/src/server.c
index e927011..70f1889 100644
--- a/src/server.c
+++ b/src/server.c
@@ -6,6 +6,7 @@
#include <netinet/in.h> /* needed for sockaddr_in */
#include <netdb.h>
#include <pthread.h>
+#include <time.h>
#include "mini_blas.h"
#include "utils.h"
@@ -83,7 +84,7 @@
{
connection_info info = *(connection_info *) pointer;
free(pointer);
- printf("New Connection\n");
+ //printf("New Connection\n");
int fd = info.fd;
network net = info.net;
int i;
@@ -118,7 +119,7 @@
write_all(fd, (char *)layer.weights, layer.outputs*layer.inputs*sizeof(float));
}
}
- printf("Received updates\n");
+ //printf("Received updates\n");
close(fd);
}
@@ -129,17 +130,23 @@
listen(fd, 10);
struct sockaddr_in client; /* remote address */
socklen_t client_size = sizeof(client); /* length of addresses */
+ time_t t=0;
while(1){
connection_info *info = calloc(1, sizeof(connection_info));
info->net = net;
info->counter = &counter;
pthread_t worker;
int connection = accept(fd, (struct sockaddr *) &client, &client_size);
+ if(!t) t=time(0);
info->fd = connection;
pthread_create(&worker, NULL, (void *) &handle_connection, info);
++counter;
+ printf("%d\n", counter);
+ if(counter == 1024) break;
if(counter%1000==0) save_network(net, "cfg/nist.part");
}
+ printf("1024 epochs: %d seconds\n", time(0)-t);
+ close(fd);
}
void client_update(network net, char *address)
--
Gitblit v1.10.0