Averaging instead of max
This commit is contained in:
parent
0e123fa55b
commit
f21da52e8c
2 changed files with 42 additions and 14 deletions
|
@ -92,7 +92,7 @@ ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=
|
||||||
#geom_point(aes(shape=conf)) +
|
#geom_point(aes(shape=conf)) +
|
||||||
theme_classic()
|
theme_classic()
|
||||||
|
|
||||||
xb <- read.csv("../res/tmp_light/t.csv")
|
xb <- read.csv("../res/tmp_light/v.csv")
|
||||||
xb$flag <- factor(xb$flag)
|
xb$flag <- factor(xb$flag)
|
||||||
xb$link_id <- factor(xb$link_id)
|
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")
|
xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 7")
|
||||||
|
@ -102,6 +102,16 @@ ggplot(data=xc, aes(x=packet_id, y=lat, color=link_id:way)) +
|
||||||
#geom_point() +
|
#geom_point() +
|
||||||
theme_classic()
|
theme_classic()
|
||||||
|
|
||||||
|
ggplot(data=sqldf("select
|
||||||
|
packet_id,way,latency,1.0 * MIN(latency) / 1000 as lat
|
||||||
|
from xb
|
||||||
|
group by packet_id,way"), aes(x=packet_id, y=lat, color=way)) +
|
||||||
|
coord_cartesian(ylim=c(100,600)) +
|
||||||
|
geom_line() +
|
||||||
|
#geom_point() +
|
||||||
|
theme_classic()
|
||||||
|
|
||||||
|
|
||||||
xd <- sqldf("
|
xd <- sqldf("
|
||||||
select
|
select
|
||||||
lat,
|
lat,
|
||||||
|
|
|
@ -42,7 +42,8 @@ char* schedule_group_target_str[] = {
|
||||||
|
|
||||||
struct stat_entry {
|
struct stat_entry {
|
||||||
uint8_t link_id;
|
uint8_t link_id;
|
||||||
int64_t max_ooo;
|
int64_t ooo;
|
||||||
|
int64_t meas_occ;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct timing_entry {
|
struct timing_entry {
|
||||||
|
@ -268,9 +269,9 @@ int algo_lightning_on_stream(struct evt_core_ctx* ctx, struct evt_core_fdinfo* f
|
||||||
|
|
||||||
int compare_stat_entry_max(const void *a, const void *b) {
|
int compare_stat_entry_max(const void *a, const void *b) {
|
||||||
const struct stat_entry *sea = a, *seb = b;
|
const struct stat_entry *sea = a, *seb = b;
|
||||||
if (sea->max_ooo == -1) return 1;
|
if (sea->ooo == -1) return 1;
|
||||||
if (seb->max_ooo == -1) return -1;
|
if (seb->ooo == -1) return -1;
|
||||||
return sea->max_ooo - seb->max_ooo;
|
return sea->ooo - seb->ooo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void algo_lightning_update_stats (struct light_ctx *lightc, struct stat_entry *stats) {
|
void algo_lightning_update_stats (struct light_ctx *lightc, struct stat_entry *stats) {
|
||||||
|
@ -281,7 +282,8 @@ void algo_lightning_update_stats (struct light_ctx *lightc, struct stat_entry *s
|
||||||
// Init
|
// Init
|
||||||
for (int i = 0; i < lightc->total_links; i++) {
|
for (int i = 0; i < lightc->total_links; i++) {
|
||||||
stats[i].link_id = i;
|
stats[i].link_id = i;
|
||||||
stats[i].max_ooo = -1;
|
stats[i].meas_occ = 0;
|
||||||
|
stats[i].ooo = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute local stats
|
// Compute local stats
|
||||||
|
@ -296,28 +298,44 @@ void algo_lightning_update_stats (struct light_ctx *lightc, struct stat_entry *s
|
||||||
case OOO_ONGOING:
|
case OOO_ONGOING:
|
||||||
timespec_diff(&now, &lightc->historic[i].detected_at, &temp_time);
|
timespec_diff(&now, &lightc->historic[i].detected_at, &temp_time);
|
||||||
delta = timespec_get_unit (&temp_time, MILISEC);
|
delta = timespec_get_unit (&temp_time, MILISEC);
|
||||||
|
stats[l].ooo += delta;
|
||||||
|
stats[l].meas_occ += 1;
|
||||||
break;
|
break;
|
||||||
case OOO_DONE:
|
case OOO_DONE:
|
||||||
timespec_diff(&lightc->historic[i].finished_at, &lightc->historic[i].detected_at, &temp_time);
|
timespec_diff(&lightc->historic[i].finished_at, &lightc->historic[i].detected_at, &temp_time);
|
||||||
delta = timespec_get_unit (&temp_time, MILISEC);
|
delta = timespec_get_unit (&temp_time, MILISEC);
|
||||||
|
stats[l].ooo += delta;
|
||||||
|
stats[l].meas_occ += 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lightc->explain) printf("(stats.compute) packet=%ld, link=%d, status=%s, delta=%ld\n", lightc->historic[i].pkt_id, l, ooo_state_str[lightc->historic[i].state], delta);
|
if (lightc->explain) printf("(stats.compute) packet=%ld, link=%d, status=%s, delta=%ld\n", lightc->historic[i].pkt_id, l, ooo_state_str[lightc->historic[i].state], delta);
|
||||||
stats[l].link_id = l;
|
stats[l].link_id = l;
|
||||||
if (delta > stats[l].max_ooo) {
|
|
||||||
if (lightc->explain) printf("(stats.local) link=%d, delta=%ld\n", l, delta);
|
if (lightc->explain) printf("(stats.local) link=%d, delta=%ld\n", l, delta);
|
||||||
stats[l].max_ooo = delta;
|
/*if (delta > stats[l].ooo) {
|
||||||
|
if (lightc->explain) printf("(stats.local) link=%d, delta=%ld\n", l, delta);
|
||||||
|
stats[l].ooo = delta;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compute average
|
||||||
|
for (int i = 0; i < lightc->total_links; i++) {
|
||||||
|
if (stats[i].meas_occ <= 0) continue;
|
||||||
|
stats[i].ooo = stats[i].ooo / stats[i].meas_occ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set my local stats + merge remote stats
|
// Set my local stats + merge remote stats
|
||||||
for (int i = 0; i < lightc->total_links; i++) {
|
for (int i = 0; i < lightc->total_links; i++) {
|
||||||
lightc->local_stats[i] = stats[i].max_ooo;
|
lightc->local_stats[i] = stats[i].ooo;
|
||||||
if (lightc->remote_stats[i] > stats[i].max_ooo) {
|
if (lightc->remote_stats[i] == -1) continue;
|
||||||
|
if (stats[i].ooo == -1) stats[i].ooo = lightc->remote_stats[i];
|
||||||
|
else stats[i].ooo = (lightc->remote_stats[i] + stats[i].ooo) / 2;
|
||||||
|
/*
|
||||||
|
if (lightc->remote_stats[i] > stats[i].ooo) {
|
||||||
if (lightc->explain) printf("(stats.remote) link=%d, delta=%d\n", i, lightc->remote_stats[i]);
|
if (lightc->explain) printf("(stats.remote) link=%d, delta=%d\n", i, lightc->remote_stats[i]);
|
||||||
stats[i].max_ooo = lightc->remote_stats[i];
|
stats[i].ooo = lightc->remote_stats[i];
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
|
@ -414,7 +432,7 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
if (ctx->verbose > 1) {
|
if (ctx->verbose > 1) {
|
||||||
printf("after sort: ");
|
printf("after sort: ");
|
||||||
for (int i = 0; i < lightc->total_links; i++) {
|
for (int i = 0; i < lightc->total_links; i++) {
|
||||||
printf("%d (%ld), ", stats[i].link_id, stats[i].max_ooo);
|
printf("%d (%ld), ", stats[i].link_id, stats[i].ooo);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue