Improve algorithm logging

This commit is contained in:
Quentin 2019-09-15 15:31:10 +02:00
parent cc08394dd0
commit 0e88336e21
3 changed files with 31 additions and 19 deletions

View file

@ -3,14 +3,14 @@ library(sqldf)
library(plyr)
library(cowplot)
thunder_ms <- read.csv("thunder_configure_ms.csv")
thunder_ms <- read.csv("thunder_configure_2_ms.csv")
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$jmax <- as.factor(thunder_ms$jmax)
v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) +
geom_boxplot( outlier.shape = NA) +
geom_boxplot() +
scale_fill_grey() +
ylim(0,1000) +
ylab("latency (ms)") +

View file

@ -344,7 +344,9 @@ thunder_configure_2_full:
tor2 -f /etc/torrc_guard_2, \
tor2 -f /etc/torrc_guard_2
thunder_configure_2_full_parse:
@. parse_lib.sh && \
parse_thunder thunder_configure_2 27
tor_just_many_latencies:
./run-3 \

View file

@ -157,7 +157,7 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
if (protect == 0) {
fprintf(stderr, "all links were blacklisted, resetting\n");
for (int i = 0; i < thunderc->total_links; i++) {
fprintf(stderr, " link=%d, blacklisted=%d, rcved=%d\n", i, thunderc->blacklisted[i], thunderc->received_pkts_on_link[i]);
fprintf(stderr, " link=%d, blacklisted=%ld, rcved=%ld\n", i, thunderc->blacklisted[i], thunderc->received_pkts_on_link[i]);
thunderc->received_pkts_on_link[i] = thunderc->blacklisted[i] + 1;
}
}
@ -170,7 +170,13 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
return 0;
}
struct block_info { uint8_t i; struct algo_ctx* app_ctx; uint64_t missing;};
struct block_info {
uint8_t i;
struct algo_ctx* app_ctx;
uint64_t missing;
uint8_t is_timeout;
char reason[1024];
};
void on_block (struct evt_core_ctx* ctx, void* raw) {
struct block_info* bi = raw;
@ -179,11 +185,11 @@ void on_block (struct evt_core_ctx* ctx, void* raw) {
if (thunderc->received_pkts_on_link[bi->i] >= bi->missing) goto release;
if (thunderc->blacklisted[bi->i] >= bi->missing) goto release;
//printf("[algo_thunder] Blacklisting link %d\n", bi->i);
puts(bi->reason);
thunderc->blacklisted[bi->i] = bi->missing;
release:
free(bi);
if (bi->is_timeout) free(bi);
}
int is_in_order(struct thunder_ctx* thunderc, uint8_t link_id) {
@ -245,28 +251,31 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
int64_t remote_delta = 0, local_delta = 0, owd_difference = 0;
remote_delta = li[i].delta_t;
local_delta = thunderc->rcv_delta_t_per_link[i];
if (remote_delta > 1000) continue; // Too many time elapsed for useful comparison
if (remote_delta > 1000 || local_delta > 10000) continue; // Too many time elapsed for useful comparison
owd_difference = local_delta - remote_delta;
if (owd_difference <= thunderc->allowed_jitter_ms && owd_difference >= -thunderc->allowed_jitter_ms) continue;
struct block_info *bi = malloc(sizeof(struct block_info));
struct block_info bi = {0};
bi.is_timeout = 0;
if (owd_difference < -thunderc->allowed_jitter_ms) {
bi->i = i;
bi->app_ctx = app_ctx;
bi->missing = thunderc->received_pkts_on_link[i];
bi.i = i;
bi.app_ctx = app_ctx;
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\n", i, owd_difference, local_delta, remote_delta);
} else if (owd_difference > thunderc->allowed_jitter_ms) {
bi->i = link_id;
bi->app_ctx = app_ctx;
bi->missing = thunderc->received_pkts_on_link[link_id];
bi.i = link_id;
bi.app_ctx = app_ctx;
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\n", link_id, owd_difference, local_delta, remote_delta);
} else {
fprintf(stderr, "Algorithm is wrong\n");
exit(EXIT_FAILURE);
}
printf(" Packet Too Late - Blocked link %d owd_diff=%ld, local_delta=%ld, remote_delta=%ld\n", i, owd_difference, local_delta, remote_delta);
on_block(ctx, bi);
on_block(ctx, &bi);
}
}
@ -278,7 +287,7 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
int64_t timeout = thunderc->allowed_jitter_ms - li[i].delta_t;
struct block_info *bi = malloc(sizeof(struct block_info));
bi->i = i; bi->app_ctx = app_ctx; bi->missing = expected;
bi->i = i; bi->app_ctx = app_ctx; bi->missing = expected; bi->is_timeout = 1;
if (timeout <= 0) {
on_block(ctx, bi);
@ -286,8 +295,9 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
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);
//printf(" Missing Packet - Triggered timeout for link %d in %ldms (expected: %ld, seen: %ld)\n", i, timeout, expected, thunderc->received_pkts_on_link[i]);
if (ctx->verbose > 1) {
fprintf(stderr, " [algo_thunder] Set timeout on link %d of %ld ms (packets expected: %ld, seen: %ld)\n",
i, timeout, expected, thunderc->received_pkts_on_link[i]);