Print link used too
This commit is contained in:
parent
9e81ba7049
commit
2a444e2193
3 changed files with 44 additions and 15 deletions
|
@ -67,3 +67,27 @@ ggplot(data=xx3, aes(x=lat, group=flag, color=flag)) +
|
|||
geom_vline(xintercept = 400) +
|
||||
coord_cartesian(xlim=c(0,1200)) +
|
||||
theme_classic()
|
||||
|
||||
xy <- read.csv("../res/tmp_light/light.csv")
|
||||
xz <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
|
||||
xz$conf <- factor(xz$conf)
|
||||
ggplot(data=xz, aes(x=lat, group=conf, color=conf)) +
|
||||
stat_ecdf(pad = FALSE) +
|
||||
geom_vline(xintercept = 200) +
|
||||
geom_vline(xintercept = 400) +
|
||||
coord_cartesian(xlim=c(0,600)) +
|
||||
theme_classic()
|
||||
|
||||
ggplot(data=xz, aes(y=lat, x=conf)) +
|
||||
geom_violin(scale='width') +
|
||||
geom_boxplot(width=0.1, outlier.shape=NA) +
|
||||
theme_classic()
|
||||
|
||||
xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where flag=1 and packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
|
||||
ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=packet_id, y=lat, color=way)) +
|
||||
geom_line() +
|
||||
geom_hline(yintercept=400) +
|
||||
geom_hline(yintercept=200) +
|
||||
coord_cartesian(ylim=c(0,1000)) +
|
||||
#geom_point(aes(shape=conf)) +
|
||||
theme_classic()
|
||||
|
|
|
@ -380,6 +380,21 @@ int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void tag_packet_measlat(union abstract_packet* ap, uint8_t link_id, uint8_t is_slow) {
|
||||
union abstract_packet* cur = ap;
|
||||
while (cur != NULL) {
|
||||
if (ap->fmt.headers.cmd != CMD_UDP_ENCAPSULATED) {
|
||||
cur = ap_next(cur);
|
||||
continue;
|
||||
}
|
||||
struct measure_packet *mp = (void*)&cur->fmt.content.udp_encapsulated.payload;
|
||||
mp->flag = 0x7f & link_id;
|
||||
mp->flag |= is_slow << 7;
|
||||
cur = ap_next(cur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
||||
struct algo_ctx* app_ctx = fdinfo->cat->app_ctx;
|
||||
struct light_ctx* lightc = app_ctx->misc;
|
||||
|
@ -415,25 +430,12 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
|||
sel_link_last = lightc->last[stats[i].link_id];
|
||||
}
|
||||
}
|
||||
if (lightc->is_measlat) tag_packet_measlat (ap, lightc->selected_link, 0);
|
||||
send_message (ctx, bp);
|
||||
if (lightc->csv) printf("%ld,%d,fast\n", now_timestamp, lightc->selected_link);
|
||||
}
|
||||
|
||||
if (lightc->sched_strat == SCHEDULE_BOTH || lightc->sched_strat == SCHEDULE_SLOW) {
|
||||
// Tag packets for slow link
|
||||
if (lightc->is_measlat) {
|
||||
union abstract_packet* cur = ap;
|
||||
while (cur != NULL) {
|
||||
if (ap->fmt.headers.cmd != CMD_UDP_ENCAPSULATED) {
|
||||
cur = ap_next(cur);
|
||||
continue;
|
||||
}
|
||||
struct measure_packet *mp = (void*)&cur->fmt.content.udp_encapsulated.payload;
|
||||
mp->flag = 1;
|
||||
cur = ap_next(cur);
|
||||
}
|
||||
}
|
||||
|
||||
// Select slow link
|
||||
sel_link_last = now;
|
||||
lightc->selected_link = UINT8_MAX;
|
||||
|
@ -443,6 +445,7 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
|||
sel_link_last = lightc->last[stats[i].link_id];
|
||||
}
|
||||
}
|
||||
if (lightc->is_measlat) tag_packet_measlat (ap, lightc->selected_link, 1);
|
||||
send_message (ctx, bp);
|
||||
if (lightc->csv) printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ void measure_parse(int size, struct measure_conf* mc) {
|
|||
char* ctime_no_newline = strtok(ctime(&now), "\n");
|
||||
|
||||
micro_sec = elapsed_micros (&head->emit_time, &curr);
|
||||
printf("[%s] Packet %llu latency %luµs with flag %d\n", ctime_no_newline, (unsigned long long)head->counter, micro_sec, head->flag);
|
||||
uint8_t is_slow = head->flag >> 7;
|
||||
uint8_t link_id = head->flag & 0x7f;
|
||||
printf("[%s] Packet %llu latency %luµs with flag %d sent on link %d\n", ctime_no_newline, (unsigned long long)head->counter, micro_sec, is_slow, link_id);
|
||||
|
||||
if (!mc->is_server && head->counter >= mc->max_measure) {
|
||||
printf("Measurement done\n");
|
||||
|
|
Loading…
Reference in a new issue