|
@@ -497,8 +497,12 @@ void generateClients(boost::asio::io_context &io_context,
|
|
|
|
|
|
|
|
|
void sendMessageBundles(uint32_t cstart, uint32_t cstop, Client* &clients,
|
|
|
- Config &config)
|
|
|
+ Config &config, unsigned long &time_diff)
|
|
|
{
|
|
|
+
|
|
|
+ struct timespec tp;
|
|
|
+ clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
+ unsigned long start = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
uint16_t priv_out = config.m_priv_out;
|
|
|
uint16_t msg_size = config.msg_size;
|
|
|
uint32_t pt_bundle_size = ptMsgBundleSize(priv_out, msg_size);
|
|
@@ -512,6 +516,10 @@ void sendMessageBundles(uint32_t cstart, uint32_t cstop, Client* &clients,
|
|
|
|
|
|
free(pt_msgbundle);
|
|
|
free(enc_msgbundle);
|
|
|
+
|
|
|
+ clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
+ unsigned long end = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
+ time_diff = end - start;
|
|
|
}
|
|
|
/*
|
|
|
Spin config.user_client actual clients. Each client:
|
|
@@ -600,25 +608,22 @@ int main(int argc, char **argv)
|
|
|
|
|
|
// Multithreaded client message bundle generation and send
|
|
|
uint32_t epoch = 0;
|
|
|
- while(epoch < 1) {
|
|
|
- struct timespec tp;
|
|
|
- clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
- unsigned long start = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
+ while(epoch < 3) {
|
|
|
+ unsigned long thread_diff[nthreads] = {0};
|
|
|
+ unsigned long diff = 0;
|
|
|
|
|
|
for(int i=0; i<nthreads; i++) {
|
|
|
uint32_t cstart, cstop;
|
|
|
cstart = i * clients_per_thread;
|
|
|
cstop = (i==nthreads-1)? num_clients_total: (i+1) * clients_per_thread;
|
|
|
threads[i] = std::thread(sendMessageBundles, cstart, cstop,
|
|
|
- std::ref(clients), std::ref(config));
|
|
|
+ std::ref(clients), std::ref(config), std::ref(thread_diff[i]));
|
|
|
}
|
|
|
for(int i=0; i<nthreads; i++) {
|
|
|
threads[i].join();
|
|
|
+ diff+=thread_diff[i];
|
|
|
}
|
|
|
|
|
|
- clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
- unsigned long end = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
- unsigned long diff = end - start;
|
|
|
// Sleep for the rest of the epoch interval
|
|
|
printf("Done with submissions for 1 epoch \n");
|
|
|
if (diff < epoch_interval_us) {
|