Commit 07ffe167 authored by Joanne Hugé's avatar Joanne Hugé

Debug server signal emission latency

parent a9221760
......@@ -87,6 +87,8 @@ static int64_t max_diff_ts = 0;
static int64_t avg_diff_ts = 0;
static uint64_t high_diff_ts = 0;
static int interval_us;
static char ts_tracemark_buf[64];
static void help(char *argv[]) {
......@@ -122,6 +124,7 @@ static void *emit_signal_thread(void *p) {
struct timespec current;
struct timespec previous_emit, previous_ts;
int64_t emit_diff, ts_diff;
int latency_spike = 0;
int ret;
// Set thread CPU affinity
......@@ -154,11 +157,15 @@ static void *emit_signal_thread(void *p) {
if((emit_diff < ((int64_t)thread_params.interval) - ERROR_MARGIN_NS) ||
(emit_diff > ((int64_t)thread_params.interval) + ERROR_MARGIN_NS)) {
fprintf(stderr, "Signal emission interval reached error threshold: %" PRIi64 "\n", emit_diff);
exit(EXIT_FAILURE);
latency_spike = 1;
}
if((ts_diff < ((int64_t)thread_params.interval) - ERROR_MARGIN_NS) ||
(ts_diff > ((int64_t)thread_params.interval) + ERROR_MARGIN_NS)) {
fprintf(stderr, "Timestamp interval reached error threshold: %" PRIi64 "\n", ts_diff);
latency_spike = 1;
}
if(latency_spike) {
fprintf(stderr, "Exiting... Current interval: %d\n", interval_us);
exit(EXIT_FAILURE);
}
}
......@@ -228,6 +235,7 @@ static void *tsn_thread(void *p) {
// Get time for statistics
clock_gettime(CLOCK_REALTIME, &current);
recv_xdp_cleanup();
interval_us = calcdiff_ns(current, previous) / 1000;
if (thread_params.start_ts)
add_ns(&next, thread_params.interval);
......@@ -288,7 +296,6 @@ static void *tsn_thread(void *p) {
else {
// Update stats
if (ingress_stats.packets_received) {
int interval_us = calcdiff_ns(current, previous) / 1000;
ingress_stats.min_interval =
_min_(interval_us, ingress_stats.min_interval);
......
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