WIP fix algo

This commit is contained in:
Quentin 2019-09-15 09:18:09 +02:00
parent 34eef75969
commit d14c40b700
2 changed files with 52 additions and 41 deletions

View file

@ -36,13 +36,6 @@ for i in $(seq 0 $(expr $instances - 1)); do
echo " instance=$i - server=${SERVER_TARGETS[$i]} - client=${CLIENT_TARGETS[$i]} - tor server=${TOR_DAEMON_SERVER[$i]} - tor client=${TOR_DAEMON_CLIENT[$i]}"
done
echo ":: Clear Resources"
for i in $(seq 0 $(expr $instances - 1)); do
echo "clear $i"
docker container inspect donarxp_server_${i} > /dev/null 2>&1 && docker kill donarxp_server_${i}
docker container inspect donarxp_client_${i} > /dev/null 2>&1 && docker kill donarxp_client_${i}
done
echo ":: Bootstrap"
echo "Create output folder..."
docker run \
@ -52,9 +45,20 @@ docker run \
registry.gitlab.inria.fr/qdufour/donar \
chown -R 1000:1000 /home/donar
echo ":: Start experiment..."
for j in $(seq 1 $REPEAT); do
run_fold=`mktemp -up ./out XXXXXXXXXXXXXXXX`
echo "start - batch_count=$j - folder=$run_fold"
echo "__reset containers"
for i in $(seq 0 $(expr $instances - 1)); do
echo "Spawning container for instance=$i..."
docker run \
echo "____clear $i"
docker container inspect donarxp_server_${i} > /dev/null 2>&1 && docker kill donarxp_server_${i}
docker container inspect donarxp_client_${i} > /dev/null 2>&1 && docker kill donarxp_client_${i}
echo "____spawning container for instance=$i..."
docker run \
--rm \
-d \
--name "donarxp_server_${i}" \
@ -63,7 +67,7 @@ docker run \
registry.gitlab.inria.fr/qdufour/donar \
${TOR_DAEMON_SERVER[$i]}
docker run \
docker run \
--rm \
-d \
--name "donarxp_client_${i}" \
@ -71,25 +75,15 @@ docker run \
-v `pwd`/out:/home/donar/out \
registry.gitlab.inria.fr/qdufour/donar \
${TOR_DAEMON_CLIENT[$i]}
echo "____create folder struct..."
docker exec donarxp_client_${i} sh -c "mkdir -p $run_fold-$i; echo repeat=$REPEAT,identifier=$IDENTIFIER > $run_fold-$i/info.txt"
docker exec donarxp_client_${i} sh -c "echo instance=$i - server=${SERVER_TARGETS[$i]} - client=${CLIENT_TARGETS[$i]} - tor server=${TOR_DAEMON_SERVER[$i]} - tor client=${TOR_DAEMON_CLIENT[$i]}>> $run_fold-$i/info.txt"
done
sleep 10
echo ":: Start experiment..."
for j in $(seq 1 $REPEAT); do
run_fold=`mktemp -up ./out XXXXXXXXXXXXXXXX`
echo "start - batch_count=$j - folder=$run_fold"
echo " reset containers"
for i in $(seq 0 $(expr $instances - 1)); do
docker exec donarxp_client_${i} sh -c "mkdir -p $run_fold-$i; echo repeat=$REPEAT,identifier=$IDENTIFIER > $run_fold-$i/info.txt"
docker exec donarxp_client_${i} sh -c "echo instance=$i - server=${SERVER_TARGETS[$i]} - client=${CLIENT_TARGETS[$i]} - tor server=${TOR_DAEMON_SERVER[$i]} - tor client=${TOR_DAEMON_CLIENT[$i]}>> $run_fold-$i/info.txt"
docker exec donarxp_client_${i} sh -c 'killall --quiet -9 bash; killall --quiet -9 donar; killall --quiet -9 measlat; killall --quiet -9 udpecho; killall --quiet -9 torecho'
docker exec donarxp_server_${i} sh -c 'killall --quiet -9 bash; killall --quiet -9 donar; killall --quiet -9 measlat; killall --quiet -9 udpecho; killall --quiet -9 torecho'
done
echo " launch servers"
echo "__launch servers"
for i in $(seq 0 $(expr $instances - 1)); do
echo " instance=$i - exec=${SERVER_TARGETS[$i]}"
docker exec donarxp_server_$i ${SERVER_TARGETS[$i]} ${run_fold}-$i &
@ -97,7 +91,7 @@ for i in $(seq 0 $(expr $instances - 1)); do
done
sleep 10
echo " launch clients"
echo "__launch clients"
(subshellpid=$BASHPID
(sleep $WAITFOR; echo " timeout"; kill -9 $subshellpid) &

View file

@ -19,7 +19,7 @@ struct thunder_ctx {
uint64_t received_pkts_on_link[MAX_LINKS];
uint64_t blacklisted[MAX_LINKS];
size_t monit_pkt_size;
uint64_t allowed_jitter_ms;
int64_t allowed_jitter_ms;
struct timespec prev_link_time, prev_rcv_link_time;
};
@ -242,11 +242,28 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
printf("\n");*/
for (int i = 0; i < thunderc->total_links; i++) {
if (thunderc->allowed_jitter_ms >= li[i].delta_t) continue;
if (li[i].delta_t - thunderc->allowed_jitter_ms <= thunderc->rcv_delta_t_per_link[i]) continue;
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 > 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));
bi->i = i; bi->app_ctx = app_ctx; bi->missing = thunderc->received_pkts_on_link[i];
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];
} else if (owd_difference > thunderc->allowed_jitter_ms) {
bi->i = i;
bi->app_ctx = app_ctx;
bi->missing = thunderc->received_pkts_on_link[i];
} else {
fprintf(stderr, "Algorithm is wrong\n");
exit(EXIT_FAILURE);
}
//printf(" Packet Too Late - Blocked link %d (expected: at least %dms ago, received: %ldms ago)\n", i, li[i].delta_t - thunderc->allowed_jitter_ms, thunderc->rcv_delta_t_per_link[i]);
on_block(ctx, bi);