|
@@ -5,6 +5,9 @@
|
|
|
#include "Untrusted.hpp"
|
|
|
#include "start.hpp"
|
|
|
|
|
|
+// epoch_duration is set to 5 seconds by default
|
|
|
+int epoch_duration = 5;
|
|
|
+
|
|
|
class Epoch {
|
|
|
NetIO &netio;
|
|
|
uint32_t epoch_num;
|
|
@@ -147,6 +150,12 @@ static void epoch_clients(NetIO &netio) {
|
|
|
|
|
|
static void route_clients_test(NetIO &netio)
|
|
|
{
|
|
|
+ // Default epoch_interval is 5 sec
|
|
|
+ size_t epoch_interval = epoch_duration * 1000000;
|
|
|
+ printf("Epoch duration = %d\n", epoch_duration);
|
|
|
+ // Sleep two epoch_interval for clients to connect
|
|
|
+ usleep(2 * epoch_interval);
|
|
|
+
|
|
|
// Precompute some WaksmanNetworks
|
|
|
const Config &config = netio.config();
|
|
|
size_t num_sizes = ecall_precompute_sort(-2);
|
|
@@ -163,7 +172,7 @@ static void route_clients_test(NetIO &netio)
|
|
|
}
|
|
|
|
|
|
// Run epoch
|
|
|
- for (int i=1; i<50; ++i) {
|
|
|
+ for (int i=1; i<=10; ++i) {
|
|
|
struct timespec tp;
|
|
|
clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
unsigned long start = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
@@ -174,12 +183,14 @@ static void route_clients_test(NetIO &netio)
|
|
|
unsigned long end = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
unsigned long diff = end - start;
|
|
|
|
|
|
- printf("Epoch time: %lu.%06lu s\n", diff/1000000, diff%1000000);
|
|
|
+ //printf("client_count = %ld\n", client_count);
|
|
|
+ printf("Epoch %d time: %lu.%06lu s\n", i, diff/1000000, diff%1000000);
|
|
|
|
|
|
// Sleep for the rest of the epoch interval
|
|
|
- if (diff < EPOCH_INTERVAL) {
|
|
|
- usleep(EPOCH_INTERVAL - (useconds_t) diff);
|
|
|
+ if (diff < epoch_interval) {
|
|
|
+ usleep(epoch_interval - (useconds_t) diff);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
netio.close();
|
|
|
exit(0);
|