int node_id = 0;
/** statistics */
-long int max = 0; /* maximum delay */
-long int min = 0; /* minimum delay */
-long int avg = 0; /* average delay */
+long unsigned int max = 0; /* maximum delay */
+long unsigned int min = ~0; /* minimum delay */
+long unsigned int avg = 0; /* average delay */
inline void timespec_sub(struct timespec *diff, const struct timespec *left,
sleep(2);
//fwp_set_rt_prio(90);
- count = 1;
+ count = 0;
while (count != num_msg) {
count++;
clock_gettime(CLOCK_MONOTONIC, &sendtime);
timespec_sub(&difftime, &recvtime, &sendtime);
tmp = difftime.tv_sec * 1000 +
difftime.tv_nsec / 1000000;
+
if (tmp > max)
max = tmp;
if (tmp < min)
printf("Min= %ld ms Max = %ld ms Avg = %ld ms\n", min, max, avg/count);
/* TODO: destroy vres and send enpoint */
+
+ exit_flag = 0;
return NULL;
}
frsh_send_endpoint_t sepoint;
frsh_vres_id_t vres;
+/** statistics */
+long unsigned int max = 0; /* maximum delay */
+long unsigned int min = ~0; /* minimum delay */
+long unsigned int avg = 0; /* average delay */
+
inline void timespec_sub(struct timespec *diff, const struct timespec *left,
const struct timespec *right)
{
struct timespec recvtime;
struct timespec sendtime;
struct timespec difftime;
+ long int tmp;
recv_pinfo.body = NULL;
/* local_addr should be handled when creating socket */
}
printf("Receive endpoint created\n");
- count = 1;
+ count = 0;
while (count != num_msg){
count++;
if ((frsh_receive_sync(repoint, msg, msg_size, &len,
timespec_sub(&difftime, &recvtime, &sendtime);
printf("Pong: Received - %s\n time= %ld us\n", msg,
difftime.tv_nsec / 1000);
+
+ tmp = difftime.tv_sec * 1000 +
+ difftime.tv_nsec / 1000000;
+
+ if (tmp > max)
+ max = tmp;
+ if (tmp < min)
+ min = tmp;
+ avg += tmp;
}
+ printf("Min= %ld ms Max = %ld ms Avg = %ld ms\n", min, max, avg/count);
+ sleep(3); /* wait to send back packet */
/* TODO: destroy vres and send enpoint */
return NULL;