Add flag support

This commit is contained in:
Quentin 2019-10-09 17:07:51 +02:00
parent 11f9b46fe1
commit 78e68a0f88
4 changed files with 17 additions and 7 deletions

View file

@ -3,16 +3,16 @@ library(sqldf)
library(plyr)
library(cowplot)
link_info <- read.csv("/tmp/h.csv")
link_info <- read.csv("../res/tmp_graph/l.txt")
ggplot(data=link_info, aes(x=timestamp, y=link, color=speed)) +
#geom_line() +
geom_point() +
theme_classic()
xx <- read.csv("/tmp/f.csv")
xx2 <- sqldf("select packet_id,MIN(latency) as lat,way from xx group by packet_id,way")
xx <- read.csv("../res/tmp_graph/i.csv")
xx2 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx group by packet_id,way")
ggplot(data=xx2, aes(x=packet_id, y=lat, color=way)) +
#geom_line() +
geom_point() +
geom_line() +
#geom_point() +
theme_classic()

View file

@ -5,6 +5,7 @@
#include "proxy.h"
#include "timer.h"
#include "proxy.h"
#include "measure.h"
#define HISTORIC_SIZE 256
#define MAX_LINKS 64
@ -41,6 +42,7 @@ struct light_ctx {
struct timespec window;
size_t monit_pkt_size;
uint8_t csv;
uint8_t is_measlat;
};
void algo_lightning_free(void* v) {
@ -76,6 +78,7 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
sscanf(token, "window=%ld", &window);
sscanf(token, "sent_past_links=%d", &lightc->sent_past_links);
sscanf(token, "csv=%c", &lightc->csv);
sscanf(token, "measlat=%c", &lightc->is_measlat);
}
}
@ -90,7 +93,8 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
printf("recovery = %d ms\n", lightc->sleep_duration);
printf("window check = %ld ms\n", window);
printf("sent_past_links = %d\n", lightc->sent_past_links);
printf("csv = %s\n", lightc->csv ? "activated" : "deacticated");
printf("csv = %s\n", lightc->csv ? "yes" : "no");
printf("measlat = %s\n", lightc->is_measlat ? "yes" : "no");
}
void monitoring(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
@ -286,6 +290,10 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
}
timespec_diff (&now, &sel_link_last, &temp_time);
uint64_t elapsed = timespec_get_unit(&temp_time, MILISEC);
if (lightc->is_measlat) {
struct measure_packet *mp = (void*)&ap->fmt.content.udp_encapsulated.payload;
mp->flag = 1;
}
if (elapsed >= lightc->sleep_duration) {
send_message (ctx, bp);
printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);

View file

@ -17,7 +17,7 @@ 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\n", ctime_no_newline, (unsigned long long)head->counter, micro_sec);
printf("[%s] Packet %llu latency %luµs with flag %d\n", ctime_no_newline, (unsigned long long)head->counter, micro_sec, head->flag);
if (!mc->is_server && head->counter >= mc->max_measure) {
printf("Measurement done\n");
@ -50,6 +50,7 @@ struct measure_packet* measure_generate(struct measure_conf* mc) {
head->counter = mc->counter;
head->is_echo = mc->is_rtt && !mc->is_server;
head->flag = 0;
if (clock_gettime(CLOCK_REALTIME, &head->emit_time) == -1) {
perror("clock_gettime error");
exit(EXIT_FAILURE);

View file

@ -18,6 +18,7 @@ struct measure_conf {
struct measure_packet {
uint64_t counter;
uint8_t is_echo;
uint8_t flag;
struct timespec emit_time;
};