Add disable scheduler option + remove recovery option
This commit is contained in:
parent
248457528e
commit
a33918ffb4
1 changed files with 19 additions and 20 deletions
|
@ -46,13 +46,13 @@ struct light_ctx {
|
||||||
uint8_t selected_link;
|
uint8_t selected_link;
|
||||||
uint8_t total_links;
|
uint8_t total_links;
|
||||||
int fast_count;
|
int fast_count;
|
||||||
int sleep_duration;
|
|
||||||
int sent_past_links;
|
int sent_past_links;
|
||||||
struct timespec window;
|
struct timespec window;
|
||||||
size_t monit_pkt_size;
|
size_t monit_pkt_size;
|
||||||
uint8_t csv;
|
uint8_t csv;
|
||||||
uint8_t is_measlat;
|
uint8_t is_measlat;
|
||||||
uint8_t explain;
|
uint8_t explain;
|
||||||
|
uint8_t disable_scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
void algo_lightning_free(void* v) {
|
void algo_lightning_free(void* v) {
|
||||||
|
@ -73,11 +73,11 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
|
||||||
lightc->selected_link = lightc->total_links - 1;
|
lightc->selected_link = lightc->total_links - 1;
|
||||||
lightc->sent_past_links = lightc->total_links;
|
lightc->sent_past_links = lightc->total_links;
|
||||||
lightc->fast_count = lightc->total_links / 2;
|
lightc->fast_count = lightc->total_links / 2;
|
||||||
lightc->sleep_duration = 500;
|
|
||||||
lightc->csv = 0;
|
lightc->csv = 0;
|
||||||
lightc->explain = 0;
|
lightc->explain = 0;
|
||||||
lightc->pkt_sent_id = 1;
|
lightc->pkt_sent_id = 1;
|
||||||
lightc->uniq_pkt_sent_id = 1;
|
lightc->uniq_pkt_sent_id = 1;
|
||||||
|
lightc->disable_scheduler = 0;
|
||||||
|
|
||||||
uint64_t window = 2000;
|
uint64_t window = 2000;
|
||||||
if (ap->algo_specific_params != NULL) {
|
if (ap->algo_specific_params != NULL) {
|
||||||
|
@ -87,12 +87,12 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
|
||||||
token = strtok_r(params, ",", &parse_ptr);
|
token = strtok_r(params, ",", &parse_ptr);
|
||||||
if (token == NULL) break;
|
if (token == NULL) break;
|
||||||
sscanf(token, "fast_count=%d", &lightc->fast_count);
|
sscanf(token, "fast_count=%d", &lightc->fast_count);
|
||||||
sscanf(token, "recovery=%d", &lightc->sleep_duration);
|
|
||||||
sscanf(token, "window=%ld", &window);
|
sscanf(token, "window=%ld", &window);
|
||||||
sscanf(token, "sent_past_links=%d", &lightc->sent_past_links);
|
sscanf(token, "sent_past_links=%d", &lightc->sent_past_links);
|
||||||
sscanf(token, "csv=%d", &lightc->csv);
|
sscanf(token, "csv=%d", &lightc->csv);
|
||||||
sscanf(token, "measlat=%d", &lightc->is_measlat);
|
sscanf(token, "measlat=%d", &lightc->is_measlat);
|
||||||
sscanf(token, "explain=%d", &lightc->explain);
|
sscanf(token, "explain=%d", &lightc->explain);
|
||||||
|
sscanf(token, "disable_scheduler=%d", &lightc->disable_scheduler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,12 +108,12 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
|
||||||
timespec_set_unit (&lightc->window, window, MILISEC);
|
timespec_set_unit (&lightc->window, window, MILISEC);
|
||||||
|
|
||||||
printf("fast_count = %d\n", lightc->fast_count);
|
printf("fast_count = %d\n", lightc->fast_count);
|
||||||
printf("recovery = %d ms\n", lightc->sleep_duration);
|
|
||||||
printf("window check = %ld ms\n", window);
|
printf("window check = %ld ms\n", window);
|
||||||
printf("sent_past_links = %d\n", lightc->sent_past_links);
|
printf("sent_past_links = %d\n", lightc->sent_past_links);
|
||||||
printf("csv = %s\n", lightc->csv ? "yes" : "no");
|
printf("csv = %s\n", lightc->csv ? "yes" : "no");
|
||||||
printf("measlat = %s\n", lightc->is_measlat ? "yes" : "no");
|
printf("measlat = %s\n", lightc->is_measlat ? "yes" : "no");
|
||||||
printf("explain = %s\n", lightc->explain ? "yes" : "no");
|
printf("explain = %s\n", lightc->explain ? "yes" : "no");
|
||||||
|
printf("disable_scheduler = %s\n", lightc->disable_scheduler ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
void algo_lightning_pad(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
void algo_lightning_pad(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
||||||
|
@ -298,7 +298,8 @@ void algo_lightning_update_stats (struct light_ctx *lightc, struct stat_entry *s
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
qsort(stats, lightc->total_links, sizeof(struct stat_entry), compare_stat_entry_max);
|
if (!lightc->disable_scheduler)
|
||||||
|
qsort(stats, lightc->total_links, sizeof(struct stat_entry), compare_stat_entry_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) {
|
int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) {
|
||||||
|
@ -376,7 +377,7 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init vars
|
// Init vars
|
||||||
struct timespec now, sel_link_last, temp_time;
|
struct timespec now, sel_link_last;
|
||||||
set_now(&now);
|
set_now(&now);
|
||||||
uint64_t now_timestamp = timespec_get_unit(&now, MILISEC);
|
uint64_t now_timestamp = timespec_get_unit(&now, MILISEC);
|
||||||
|
|
||||||
|
@ -392,17 +393,7 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
send_message (ctx, bp);
|
send_message (ctx, bp);
|
||||||
if (lightc->csv) printf("%ld,%d,fast\n", now_timestamp, lightc->selected_link);
|
if (lightc->csv) printf("%ld,%d,fast\n", now_timestamp, lightc->selected_link);
|
||||||
|
|
||||||
// Select slow link
|
// Tag packets for slow link
|
||||||
sel_link_last = now;
|
|
||||||
lightc->selected_link = UINT8_MAX;
|
|
||||||
for (int i = lightc->fast_count; i < lightc->total_links; i++) {
|
|
||||||
if (timespec_lt (&lightc->last[stats[i].link_id], &sel_link_last)) {
|
|
||||||
lightc->selected_link = stats[i].link_id;
|
|
||||||
sel_link_last = lightc->last[stats[i].link_id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
timespec_diff (&now, &sel_link_last, &temp_time);
|
|
||||||
uint64_t elapsed = timespec_get_unit(&temp_time, MILISEC);
|
|
||||||
if (lightc->is_measlat) {
|
if (lightc->is_measlat) {
|
||||||
union abstract_packet* cur = ap;
|
union abstract_packet* cur = ap;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
|
@ -415,10 +406,18 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
cur = ap_next(cur);
|
cur = ap_next(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (elapsed >= lightc->sleep_duration) {
|
|
||||||
send_message (ctx, bp);
|
// Select slow link
|
||||||
if (lightc->csv) printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);
|
sel_link_last = now;
|
||||||
|
lightc->selected_link = UINT8_MAX;
|
||||||
|
for (int i = lightc->fast_count; i < lightc->total_links; i++) {
|
||||||
|
if (timespec_lt (&lightc->last[stats[i].link_id], &sel_link_last)) {
|
||||||
|
lightc->selected_link = stats[i].link_id;
|
||||||
|
sel_link_last = lightc->last[stats[i].link_id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
send_message (ctx, bp);
|
||||||
|
if (lightc->csv) printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);
|
||||||
|
|
||||||
lightc->uniq_pkt_sent_id++;
|
lightc->uniq_pkt_sent_id++;
|
||||||
mv_buffer_rtof (&app_ctx->br, fdinfo);
|
mv_buffer_rtof (&app_ctx->br, fdinfo);
|
||||||
|
|
Loading…
Reference in a new issue