Better logging and probably fix

This commit is contained in:
Quentin 2019-09-15 18:10:45 +02:00
parent 9a6830ccd5
commit c6ba30e687
2 changed files with 19 additions and 15 deletions

View file

@ -3,7 +3,7 @@ library(sqldf)
library(plyr) library(plyr)
library(cowplot) library(cowplot)
thunder_ms <- read.csv("thunder_configure_2_ms.csv") thunder_ms <- read.csv("thunder_configure_4_ms.csv")
thunder_ms <- sqldf("select run,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms") thunder_ms <- sqldf("select run,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms")
thunder_ms$links <- as.factor(thunder_ms$links) thunder_ms$links <- as.factor(thunder_ms$links)

View file

@ -185,7 +185,7 @@ void on_block (struct evt_core_ctx* ctx, void* raw) {
if (thunderc->received_pkts_on_link[bi->i] >= bi->missing) goto release; if (thunderc->received_pkts_on_link[bi->i] >= bi->missing) goto release;
if (thunderc->blacklisted[bi->i] >= bi->missing) goto release; if (thunderc->blacklisted[bi->i] >= bi->missing) goto release;
puts(bi->reason); printf("%s\n", bi->reason);
thunderc->blacklisted[bi->i] = bi->missing; thunderc->blacklisted[bi->i] = bi->missing;
release: release:
@ -249,6 +249,10 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
for (int i = 0; i < thunderc->total_links; i++) { for (int i = 0; i < thunderc->total_links; i++) {
int64_t remote_delta = 0, local_delta = 0, owd_difference = 0; int64_t remote_delta = 0, local_delta = 0, owd_difference = 0;
uint64_t expected = i <= link_id ? thunderc->received_pkts_on_link[link_id] : thunderc->received_pkts_on_link[link_id] - 1;
if (thunderc->received_pkts_on_link[i] != expected) continue;
remote_delta = li[i].delta_t; remote_delta = li[i].delta_t;
local_delta = thunderc->rcv_delta_t_per_link[i]; local_delta = thunderc->rcv_delta_t_per_link[i];
if (remote_delta > 1000 || local_delta > 10000) continue; // Too many time elapsed for useful comparison if (remote_delta > 1000 || local_delta > 10000) continue; // Too many time elapsed for useful comparison
@ -256,26 +260,26 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
owd_difference = local_delta - remote_delta; owd_difference = local_delta - remote_delta;
if (owd_difference <= thunderc->allowed_jitter_ms && owd_difference >= -thunderc->allowed_jitter_ms) continue; if (owd_difference <= thunderc->allowed_jitter_ms && owd_difference >= -thunderc->allowed_jitter_ms) continue;
struct block_info bi = {0}; struct block_info *bi = malloc(sizeof(struct block_info));
bi.is_timeout = 0; bi->app_ctx = app_ctx; bi->is_timeout = 1;
bi->is_timeout = 0;
bi->app_ctx = app_ctx;
sprintf(bi->reason, "Erreur");
if (owd_difference < -thunderc->allowed_jitter_ms) { if (owd_difference < -thunderc->allowed_jitter_ms) {
bi.i = i; bi->i = i;
bi.app_ctx = app_ctx; bi->missing = expected;
bi.missing = thunderc->received_pkts_on_link[i]; sprintf(bi->reason, " Packet Too Late - Blocked link %d owd_diff=%ld, local_delta=%ld, remote_delta=%ld", i, owd_difference, local_delta, remote_delta);
sprintf(bi.reason, " Packet Too Late - Blocked link %d owd_diff=%ld, local_delta=%ld, remote_delta=%ld\n", i, owd_difference, local_delta, remote_delta);
} else if (owd_difference > thunderc->allowed_jitter_ms) { } else if (owd_difference > thunderc->allowed_jitter_ms) {
bi.i = link_id; bi->i = link_id;
bi.app_ctx = app_ctx; bi->missing = thunderc->received_pkts_on_link[link_id];
bi.missing = thunderc->received_pkts_on_link[link_id]; sprintf(bi->reason, " Packet Too Late - Blocked link %d owd_diff=%ld, local_delta=%ld, remote_delta=%ld", link_id, owd_difference, local_delta, remote_delta);
sprintf(bi.reason, " Packet Too Late - Blocked link %d owd_diff=%ld, local_delta=%ld, remote_delta=%ld\n", link_id, owd_difference, local_delta, remote_delta);
} else { } else {
fprintf(stderr, "Algorithm is wrong\n"); fprintf(stderr, "Algorithm is wrong\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
on_block(ctx, bi);
on_block(ctx, &bi);
} }
} }
@ -289,13 +293,13 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
struct block_info *bi = malloc(sizeof(struct block_info)); struct block_info *bi = malloc(sizeof(struct block_info));
bi->i = i; bi->app_ctx = app_ctx; bi->missing = expected; bi->is_timeout = 1; bi->i = i; bi->app_ctx = app_ctx; bi->missing = expected; bi->is_timeout = 1;
sprintf(bi->reason, " Missing Packet - Timeout for link %d after %ldms (expected: %ld, seen: %ld)", i, timeout, expected, thunderc->received_pkts_on_link[i]);
if (timeout <= 0) { if (timeout <= 0) {
on_block(ctx, bi); on_block(ctx, bi);
//printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld)\n", i, expected, thunderc->received_pkts_on_link[i]); //printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld)\n", i, expected, thunderc->received_pkts_on_link[i]);
continue; continue;
} }
sprintf(bi->reason, " Missing Packet - Timeout for link %d after %ldms (expected: %ld, seen: %ld)\n", i, timeout, expected, thunderc->received_pkts_on_link[i]);
set_timeout (ctx, timeout, bi, on_block); set_timeout (ctx, timeout, bi, on_block);
if (ctx->verbose > 1) { if (ctx->verbose > 1) {