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

Merge branch 'master' into measure-analysis

parents 356a4683 fd20bd9e
......@@ -211,19 +211,16 @@ int main(int argc, char *argv[]) {
if (main_param.verbose) {
if (tsn_task == RTT_TASK) {
printf("RTT: %" PRIu64 " (%d)\n", stats->rtt, stats->nb_cycles);
printf("%*d: RTT: %*" PRIu64 "\n", 10, stats->nb_cycles, 10, stats->rtt);
printf("\033[%dA", 1);
} 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: U: %*" PRIi64 ", K: %*" PRIi64 "\n",
10, stats->nb_cycles, 10, user_space_time, 10, kernel_space_time);
printf("\033[%dA", 1);
}
}
......@@ -263,11 +260,11 @@ static void do_tsn_task(struct thread_param *param, char *data, uint64_t next_tx
if (enable_histograms) {
rtt_us = param->stats.rtt / 1000;
if (rtt_us > MAX_HIST_VAL) {
if (rtt_us > MAX_HIST_VAL)
fprintf(stderr, "RTT value higher than MAX_HIST_VAL : %d ( > %d)\n", rtt_us, MAX_HIST_VAL);
exit(EXIT_FAILURE);
}
histograms[0][rtt_us]++;
else
histograms[0][rtt_us]++;
}
}
}
......
......@@ -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>
......@@ -173,17 +172,15 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
user_space_time /= 1000u;
kernel_space_time /= 1000u;
if (user_space_time > MAX_HIST_VAL) {
if (user_space_time > MAX_HIST_VAL)
fprintf(stderr, "user_space_time value too high: %" PRIu64 "us\n", user_space_time);
exit(EXIT_FAILURE);
}
if (kernel_space_time > MAX_HIST_VAL) {
fprintf(stderr, "kernel_space_time value too high: %" PRIu64 "us\n", kernel_space_time);
exit(EXIT_FAILURE);
}
else
histograms[0][user_space_time]++;
histograms[0][user_space_time]++;
histograms[1][kernel_space_time]++;
if (kernel_space_time > MAX_HIST_VAL)
fprintf(stderr, "kernel_space_time value too high: %" PRIu64 "us\n", kernel_space_time);
else
histograms[1][kernel_space_time]++;
}
#ifdef DEBUG
......
......@@ -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
......@@ -208,17 +208,15 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
user_space_time /= 1000u;
kernel_space_time /= 1000u;
if (user_space_time > MAX_HIST_VAL) {
if (user_space_time > MAX_HIST_VAL)
fprintf(stderr, "user_space_time value too high: %" PRIu64 "us\n", user_space_time);
exit(EXIT_FAILURE);
}
if (kernel_space_time > MAX_HIST_VAL) {
fprintf(stderr, "kernel_space_time value too high: %" PRIu64 "us\n", kernel_space_time);
exit(EXIT_FAILURE);
}
else
histograms[0][user_space_time]++;
histograms[0][user_space_time]++;
histograms[1][kernel_space_time]++;
if (kernel_space_time > MAX_HIST_VAL)
fprintf(stderr, "kernel_space_time value too high: %" PRIu64 "us\n", kernel_space_time);
else
histograms[1][kernel_space_time]++;
}
static void process_timestamps(packet_info_t *packet_info, int64_t histograms[NB_HISTOGRAMS][MAX_HIST_VAL]) {
......
......@@ -157,12 +157,11 @@ static void *packet_receiving_thread(void *p) {
if (enable_histograms) {
dist_to_interval = (((int64_t)diff) - param->interval) / 1000;
dist_to_interval += MAX_HIST_VAL / 2;
if (dist_to_interval > ((int)MAX_HIST_VAL) || dist_to_interval < 0) {
if (dist_to_interval > ((int)MAX_HIST_VAL) || dist_to_interval < 0)
fprintf(stderr, "jitter higher than MAX_HIST_VAL: %" PRIi64 "\n", dist_to_interval);
exit(EXIT_FAILURE);
} else {
else
histograms[2][dist_to_interval]++;
}
}
}
......@@ -179,7 +178,6 @@ static void *packet_receiving_thread(void *p) {
int main(int argc, char *argv[]) {
pthread_t thread;
thread_stat_t *stats;
int64_t diff;
param = malloc(sizeof(thread_param_t));
stats = &param->stats;
......@@ -227,24 +225,29 @@ int main(int argc, char *argv[]) {
if (main_param.verbose) {
if (tsn_task == RECV_PACKET_TASK) {
diff = ((int64_t)stats->max_interval) - stats->min_interval;
printf("(%d) Jitter : %" PRIi64 " [Packet data: %s] [Lost packets: %d]\n",
stats->packets_received,
diff,
stats->packet_info.data,
stats->lost_packets);
int64_t jitter = ((int64_t)stats->max_interval) - stats->min_interval;
printf("%*d: J: %*" PRIi64,
10, stats->packets_received,
10, jitter);
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(", U: %*" PRIi64 ", K: %*" PRIi64 ", D: %*s, L: %*d\n",
10, user_space_time,
10, kernel_space_time,
4, stats->packet_info.data,
4, stats->lost_packets);
}
else {
printf("\n");
}
printf("\033[%dA", 1);
}
}
}
......
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