Scheduler V2

This commit is contained in:
Quentin 2019-10-22 10:38:13 +02:00
parent c0102d12fc
commit 9234d9c1c0

View file

@ -319,6 +319,8 @@ void algo_lightning_update_stats (struct light_ctx *lightc) {
int64_t delta = 0; int64_t delta = 0;
switch (lightc->historic[i].state) { switch (lightc->historic[i].state) {
case IN_ORDER: case IN_ORDER:
lightc->stats[l].ooo += delta;
lightc->stats[l].meas_occ += 1;
break; break;
case OOO_ONGOING: case OOO_ONGOING:
timespec_diff(&now, &lightc->historic[i].detected_at, &temp_time); timespec_diff(&now, &lightc->historic[i].detected_at, &temp_time);
@ -465,12 +467,12 @@ void algo_lightning_update_used(struct light_ctx *lightc, struct timespec *now)
} }
// Do we have a good link not used? // Do we have a good link not used?
for (int i = 0; i < lightc->used; i++) { /*for (int i = 0; i < lightc->used; i++) {
if (lightc->status[lightc->stats[i].link_id].used == LINK_NOT_USED) { if (lightc->status[lightc->stats[i].link_id].used == LINK_NOT_USED) {
not_to_used = lightc->stats[i].link_id; not_to_used = lightc->stats[i].link_id;
break; break;
} }
} }*/
// Swap them // Swap them
printf("Link %d will be disabled, %d will be enabled\n", used_to_not, not_to_used); printf("Link %d will be disabled, %d will be enabled\n", used_to_not, not_to_used);