Add flag support
This commit is contained in:
parent
11f9b46fe1
commit
78e68a0f88
|
@ -3,16 +3,16 @@ library(sqldf)
|
||||||
library(plyr)
|
library(plyr)
|
||||||
library(cowplot)
|
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)) +
|
ggplot(data=link_info, aes(x=timestamp, y=link, color=speed)) +
|
||||||
#geom_line() +
|
#geom_line() +
|
||||||
geom_point() +
|
geom_point() +
|
||||||
theme_classic()
|
theme_classic()
|
||||||
|
|
||||||
|
|
||||||
xx <- read.csv("/tmp/f.csv")
|
xx <- read.csv("../res/tmp_graph/i.csv")
|
||||||
xx2 <- sqldf("select packet_id,MIN(latency) as lat,way from xx group by packet_id,way")
|
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)) +
|
ggplot(data=xx2, aes(x=packet_id, y=lat, color=way)) +
|
||||||
#geom_line() +
|
geom_line() +
|
||||||
geom_point() +
|
#geom_point() +
|
||||||
theme_classic()
|
theme_classic()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
#include "measure.h"
|
||||||
#define HISTORIC_SIZE 256
|
#define HISTORIC_SIZE 256
|
||||||
#define MAX_LINKS 64
|
#define MAX_LINKS 64
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ struct light_ctx {
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
void algo_lightning_free(void* v) {
|
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, "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=%c", &lightc->csv);
|
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("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 ? "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) {
|
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);
|
timespec_diff (&now, &sel_link_last, &temp_time);
|
||||||
uint64_t elapsed = timespec_get_unit(&temp_time, MILISEC);
|
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) {
|
if (elapsed >= lightc->sleep_duration) {
|
||||||
send_message (ctx, bp);
|
send_message (ctx, bp);
|
||||||
printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);
|
printf("%ld,%d,slow\n", now_timestamp, lightc->selected_link);
|
||||||
|
|
|
@ -17,7 +17,7 @@ void measure_parse(int size, struct measure_conf* mc) {
|
||||||
char* ctime_no_newline = strtok(ctime(&now), "\n");
|
char* ctime_no_newline = strtok(ctime(&now), "\n");
|
||||||
|
|
||||||
micro_sec = elapsed_micros (&head->emit_time, &curr);
|
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) {
|
if (!mc->is_server && head->counter >= mc->max_measure) {
|
||||||
printf("Measurement done\n");
|
printf("Measurement done\n");
|
||||||
|
@ -50,6 +50,7 @@ struct measure_packet* measure_generate(struct measure_conf* mc) {
|
||||||
|
|
||||||
head->counter = mc->counter;
|
head->counter = mc->counter;
|
||||||
head->is_echo = mc->is_rtt && !mc->is_server;
|
head->is_echo = mc->is_rtt && !mc->is_server;
|
||||||
|
head->flag = 0;
|
||||||
if (clock_gettime(CLOCK_REALTIME, &head->emit_time) == -1) {
|
if (clock_gettime(CLOCK_REALTIME, &head->emit_time) == -1) {
|
||||||
perror("clock_gettime error");
|
perror("clock_gettime error");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct measure_conf {
|
||||||
struct measure_packet {
|
struct measure_packet {
|
||||||
uint64_t counter;
|
uint64_t counter;
|
||||||
uint8_t is_echo;
|
uint8_t is_echo;
|
||||||
|
uint8_t flag;
|
||||||
struct timespec emit_time;
|
struct timespec emit_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue