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[]) { ...@@ -215,15 +215,13 @@ int main(int argc, char *argv[]) {
} else if (enable_timestamps) { } else if (enable_timestamps) {
printf("(%d) Enter send_udp_packet timestamp: %" PRIu64 "\n", int64_t user_space_time = stats->packet_info.userspace_exit_ts - stats->packet_info.userspace_enter_ts;
stats->nb_cycles, int64_t kernel_space_time = stats->packet_info.kernelspace_ts - stats->packet_info.userspace_exit_ts;
stats->packet_info.userspace_enter_ts);
printf("(%d) Call sendmsg timestamp : %" PRIu64 "\n", printf("(%d) User space time: %" PRIi64 "\n",
stats->nb_cycles, stats->nb_cycles, user_space_time);
stats->packet_info.userspace_exit_ts); printf("(%d) Kernel space time: %" PRIi64 "\n",
printf("(%d) Leave kernel timestamp : %" PRIu64 "\n", stats->nb_cycles, kernel_space_time);
stats->nb_cycles,
stats->packet_info.kernelspace_ts);
} }
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <net/if.h> #include <net/if.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <poll.h>
#include <pthread.h> #include <pthread.h>
#include <sched.h> #include <sched.h>
#include <signal.h> #include <signal.h>
......
...@@ -190,7 +190,7 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps, ...@@ -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); error(EXIT_FAILURE, errno, "sendmsg failed, ret value: %d\n", sendmsgerr);
if (use_timestamps) { if (use_timestamps) {
pollerr = poll(&poll_fd, 1, 0); pollerr = poll(&poll_fd, 1, 1);
if (pollerr > 0) if (pollerr > 0)
process_timestamps(&packet_info, histograms); process_timestamps(&packet_info, histograms);
else else
......
...@@ -234,15 +234,14 @@ int main(int argc, char *argv[]) { ...@@ -234,15 +234,14 @@ int main(int argc, char *argv[]) {
stats->lost_packets); stats->lost_packets);
if (enable_timestamps) { if (enable_timestamps) {
printf("(%d) Enter send_udp_packet timestamp: %" PRIu64 "\n",
stats->packets_received, int64_t user_space_time = stats->packet_info.userspace_exit_ts - stats->packet_info.userspace_enter_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) Call sendmsg timestamp : %" PRIu64 "\n",
stats->packets_received, printf("(%d) User space time: %" PRIi64 "\n",
stats->packet_info.userspace_exit_ts); stats->nb_cycles, user_space_time);
printf("(%d) Leave kernel timestamp : %" PRIu64 "\n", printf("(%d) Kernel space time: %" PRIi64 "\n",
stats->packets_received, stats->nb_cycles, kernel_space_time);
stats->packet_info.kernelspace_ts);
} }
} }
} }
......
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