Commit c1fa2847 authored by Joanne Hugé's avatar Joanne Hugé

Make polling blocking and print timestamps differently

parent ca9800c4
......@@ -215,15 +215,13 @@ int main(int argc, char *argv[]) {
} else if (enable_timestamps) {
printf("(%d) Enter send_udp_packet timestamp: %" PRIu64 "\n",
stats->nb_cycles,
stats->packet_info.userspace_enter_ts);
printf("(%d) Call sendmsg timestamp : %" PRIu64 "\n",
stats->nb_cycles,
stats->packet_info.userspace_exit_ts);
printf("(%d) Leave kernel timestamp : %" PRIu64 "\n",
stats->nb_cycles,
stats->packet_info.kernelspace_ts);
int64_t user_space_time = stats->packet_info.userspace_exit_ts - stats->packet_info.userspace_enter_ts;
int64_t kernel_space_time = stats->packet_info.kernelspace_ts - stats->packet_info.userspace_exit_ts;
printf("(%d) User space time: %" PRIi64 "\n",
stats->nb_cycles, user_space_time);
printf("(%d) Kernel space time: %" PRIi64 "\n",
stats->nb_cycles, kernel_space_time);
}
}
......
......@@ -12,7 +12,6 @@
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
#include <pthread.h>
#include <sched.h>
#include <signal.h>
......
......@@ -190,7 +190,7 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps,
error(EXIT_FAILURE, errno, "sendmsg failed, ret value: %d\n", sendmsgerr);
if (use_timestamps) {
pollerr = poll(&poll_fd, 1, 0);
pollerr = poll(&poll_fd, 1, 1);
if (pollerr > 0)
process_timestamps(&packet_info, histograms);
else
......
......@@ -234,15 +234,14 @@ int main(int argc, char *argv[]) {
stats->lost_packets);
if (enable_timestamps) {
printf("(%d) Enter send_udp_packet timestamp: %" PRIu64 "\n",
stats->packets_received,
stats->packet_info.userspace_enter_ts);
printf("(%d) Call sendmsg timestamp : %" PRIu64 "\n",
stats->packets_received,
stats->packet_info.userspace_exit_ts);
printf("(%d) Leave kernel timestamp : %" PRIu64 "\n",
stats->packets_received,
stats->packet_info.kernelspace_ts);
int64_t user_space_time = stats->packet_info.userspace_exit_ts - stats->packet_info.userspace_enter_ts;
int64_t kernel_space_time = stats->packet_info.kernelspace_ts - stats->packet_info.userspace_exit_ts;
printf("(%d) User space time: %" PRIi64 "\n",
stats->nb_cycles, user_space_time);
printf("(%d) Kernel space time: %" PRIi64 "\n",
stats->nb_cycles, kernel_space_time);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment