diff --git a/r/lightning_begin.R b/r/lightning_begin.R index 3af8f15..48a92d3 100644 --- a/r/lightning_begin.R +++ b/r/lightning_begin.R @@ -91,3 +91,38 @@ ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x= coord_cartesian(ylim=c(0,1000)) + #geom_point(aes(shape=conf)) + theme_classic() + +xb <- read.csv("../res/tmp_light/t.csv") +xb$flag <- factor(xb$flag) +xb$link_id <- factor(xb$link_id) +xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 7") +ggplot(data=xc, aes(x=packet_id, y=lat, color=link_id:way)) + + coord_cartesian(ylim=c(100,600)) + + geom_line() + + #geom_point() + + theme_classic() + +xd <- sqldf(" +select + lat, + xb.latency, + vanilla, + xb.packet_id, + xb.way, + link_id, + flag +from +(select + packet_id,way,latency,1.0 * MIN(latency) / 1000 as lat +from xb +group by packet_id,way) nn, +xb +where + xb.latency = nn.latency and + xb.packet_id = nn.packet_id and + xb.way = nn.way +") +ggplot(data=xd, aes(x=packet_id, y=lat, color=link_id)) + + #coord_cartesian(ylim=c(0,1000),xlim=c(3200,3500)) + + geom_line() + + theme_classic() diff --git a/scripts/parse_lat.py b/scripts/parse_lat.py index 424a32e..b62d21f 100755 --- a/scripts/parse_lat.py +++ b/scripts/parse_lat.py @@ -3,7 +3,7 @@ import sys,re way=sys.argv[1] for line in sys.stdin: - res = re.match(r".*Packet (\d+) latency (\d+)µs with flag (\d+).*", line) + res = re.match(r".*Packet (\d+) latency (\d+)µs with flag (\d+) sent on link (\d+) with vanilla (\d+).*", line) if not res: continue - pid,lat,flag = res.groups() - print(f"{pid},{lat},{flag},{way}") + pid,lat,flag,link,vanilla = res.groups() + print(f"{pid},{lat},{flag},{link},{vanilla},{way}") diff --git a/src/algo_lightning.c b/src/algo_lightning.c index c41fded..addd16d 100644 --- a/src/algo_lightning.c +++ b/src/algo_lightning.c @@ -381,18 +381,22 @@ int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) { } 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); - } + union abstract_packet* cur = ap; + uint8_t vanilla = 1; + 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 |= vanilla << 6; + mp->flag |= is_slow << 7; + + vanilla = 0; + cur = ap_next(cur); + } } int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) { diff --git a/src/measure.c b/src/measure.c index c52667b..83a6e1c 100644 --- a/src/measure.c +++ b/src/measure.c @@ -18,8 +18,16 @@ void measure_parse(int size, struct measure_conf* mc) { micro_sec = elapsed_micros (&head->emit_time, &curr); 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); + uint8_t is_vanilla = (head->flag & 0x40) >> 6; + uint8_t link_id = head->flag & 0x3f; + printf( + "[%s] Packet %llu latency %luµs with flag %d sent on link %d with vanilla %d\n", + ctime_no_newline, + (unsigned long long)head->counter, + micro_sec, + is_slow, + link_id, + is_vanilla); if (!mc->is_server && head->counter >= mc->max_measure) { printf("Measurement done\n");