Commit c4f0c211 authored by Andreas Schmidt's avatar Andreas Schmidt

New paces concept.

parent b0b45f38
......@@ -101,7 +101,7 @@ static bool send_feedback(PrrtSocket *sock_ptr,
PrrtLossStatistics stats = sock_ptr->lossStatistics;
int group_RTT = 0; // TODO: To be determined.
uint32_t local_bottleneck_pace = MAX(PrrtPace_get_eff(sock_ptr->appDeliverPace), PrrtPace_get_eff(sock_ptr->prrtReceivePace));
uint32_t local_bottleneck_pace = 0; // MAX(PrrtPace_get_eff(sock_ptr->appDeliverPace), PrrtPace_get_eff(sock_ptr->prrtReceivePace));
PrrtPacket *feedback_pkt_ptr = PrrtPacket_create_feedback_packet(0, sock_ptr->sequenceNumberFeedback++, group_RTT,
stats.gapLength, stats.gapCount, stats.burstLength,
stats.burstCount, forwardTripTime,
......
......@@ -112,7 +112,7 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
channelPacingTime = (prrtTimedelta_t) round(((1000 * 1000 * ((double) packet->payloadLength)) / pacing_rate));
}
// Cross-Pace iff PROBE_BW and unity gain
if(sock_ptr->recv_peer_btl_pace != 0 && state == PROBE_BW) {
if(sock_ptr->recv_peer_btl_pace != 0 /*&& state == PROBE_BW*/) {
peerPacingTime = sock_ptr->recv_peer_btl_pace;
/*double pt = round(((double) sock_ptr->recv_peer_btl_pace) / pacing_gain;
if (pt > (TIMESTAMP_SPACE-1)) {
......@@ -127,7 +127,7 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
sock_ptr->nextSendTime = now + pacingTime;
}
// Update timestamp
prrtTimedelta_t btl_pace = MAX(MAX(PrrtPace_get_max(sock_ptr->prrtTransmitPace), PrrtPace_get_max(sock_ptr->appSendPace)), PrrtSocket_get_sock_opt(sock_ptr, "nw_pace"));
prrtTimedelta_t btl_pace = 0; //MAX(MAX(PrrtPace_get_max(sock_ptr->prrtTransmitPace), PrrtPace_get_max(sock_ptr->appSendPace)), PrrtSocket_get_sock_opt(sock_ptr, "nw_pace"));
if(PrrtPacket_type(packet) == PACKET_TYPE_DATA) {
((PrrtPacketDataPayload*) (packet->payload))->timestamp = PrrtClock_get_current_time_us();
((PrrtPacketDataPayload*) (packet->payload))->btlbw = PrrtReceiver_get_BBR_btlDr(sock_ptr->receiver);
......
......@@ -60,7 +60,7 @@ bool PrrtSocket_pace(PrrtSocket *s, bool prepace) {
prrtTimestamp_t now = PrrtClock_get_current_time_us();
diff = PrrtTimestamp_cmp(s->nextSendTime, now);
if (!prepace) { // post-pacing removes appSendPace
diff -= PrrtPace_get_diff(s->appSendPace);
// TODO: diff -= PrrtPace_get_diff(s->appSendPace);
diff = MAX(0, diff);
}
if (diff > 0) {
......@@ -551,22 +551,6 @@ int PrrtSocket_close(PrrtSocket *s) {
uint32_t PrrtSocket_get_sock_opt(PrrtSocket *s, const char *name) {
if (strcmp(name, "targetdelay") == 0) {
return PrrtApplicationConstraints_get_target_delay(s->applicationConstraints);
} else if (strcmp(name, "app_send_max_pace") == 0) {
return PrrtPace_get_max(s->appSendPace);
} else if (strcmp(name, "app_send_eff_pace") == 0) {
return PrrtPace_get_eff(s->appSendPace);
} else if (strcmp(name, "prrt_transmit_max_pace") == 0) {
return PrrtPace_get_max(s->prrtTransmitPace);
} else if (strcmp(name, "prrt_transmit_eff_pace") == 0) {
return PrrtPace_get_eff(s->prrtTransmitPace);
} else if (strcmp(name, "prrt_receive_max_pace") == 0) {
return PrrtPace_get_max(s->prrtReceivePace);
} else if (strcmp(name, "prrt_receive_eff_pace") == 0) {
return PrrtPace_get_eff(s->prrtReceivePace);
} else if (strcmp(name, "app_deliver_max_pace") == 0) {
return PrrtPace_get_max(s->appDeliverPace);
} else if (strcmp(name, "app_deliver_eff_pace") == 0) {
return PrrtPace_get_eff(s->appDeliverPace);
} else if (strcmp(name, "send_peer_btl_pace") == 0) {
return s->send_peer_btl_pace;
} else if (strcmp(name, "recv_peer_btl_pace") == 0) {
......
......@@ -8,11 +8,14 @@
PrrtPace* PrrtPace_create(void) {
PrrtPace* pace = (PrrtPace*) calloc(1, sizeof(PrrtPace));
check_mem(pace);
pace->effectivePace = PrrtPaceFilter_create(50 * 1000);
pace->maximumPace = PrrtPaceFilter_create(50 * 1000);
prrtTimedelta_t filterLength_us = 50 * 1000;
pace->internalPace = PrrtPaceFilter_create(filterLength_us);
pace->dependentPace = PrrtPaceFilter_create(filterLength_us);
pace->externalPace = PrrtPaceFilter_create(filterLength_us);
pace->totalPauseDuration_ns = 0;
pace->init = false;
pace->first = false;
pace->initialized = false;
pace->firstRoundDone = false;
clock_gettime(CLOCK_REALTIME, &pace->lastStartTimestamp);
clock_gettime(CLOCK_REALTIME, &pace->lastEndTimestamp);
clock_gettime(CLOCK_REALTIME, &pace->lastPauseTimestamp);
......@@ -24,11 +27,16 @@ PrrtPace* PrrtPace_create(void) {
}
bool PrrtPace_destroy(PrrtPace* pace) {
if(pace->maximumPace != NULL) {
check(PrrtPaceFilter_destroy(pace->maximumPace), "Cannot destroy maximumPace.")
if(pace->internalPace != NULL) {
check(PrrtPaceFilter_destroy(pace->internalPace), "Cannot destroy internalPace.")
}
if(pace->effectivePace != NULL) {
check(PrrtPaceFilter_destroy(pace->effectivePace), "Cannot destroy effectivePace.")
if(pace->dependentPace != NULL) {
check(PrrtPaceFilter_destroy(pace->dependentPace), "Cannot destroy dependentPace.")
}
if(pace->externalPace != NULL) {
check(PrrtPaceFilter_destroy(pace->externalPace), "Cannot destroy externalPace.")
}
free(pace);
......@@ -37,38 +45,43 @@ bool PrrtPace_destroy(PrrtPace* pace) {
return false;
}
prrtTimedelta_t PrrtPace_get_eff(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->effectivePace);
prrtTimedelta_t PrrtPace_get_internal(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->internalPace);
}
prrtTimedelta_t PrrtPace_get_max(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->maximumPace);
prrtTimedelta_t PrrtPace_get_external(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->externalPace);
}
prrtTimedelta_t PrrtPace_get_diff(PrrtPace* pace) {
int64_t paceMax = PrrtPaceFilter_get(pace->maximumPace);
int64_t paceEff = PrrtPaceFilter_get(pace->effectivePace);
uint32_t paceDiff = (uint32_t) MAX(0, paceEff - paceMax);
return paceDiff;
prrtTimedelta_t PrrtPace_get_dependent(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->dependentPace);
}
prrtTimedelta_t PrrtPace_get_total(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->internalPace) + PrrtPaceFilter_get(pace->externalPace);
}
prrtTimedelta_t PrrtPace_get_effective(PrrtPace* pace) {
return PrrtPaceFilter_get(pace->externalPace) + PrrtPaceFilter_get(pace->internalPace) - PrrtPaceFilter_get(pace->dependentPace);
}
void PrrtPace_track_start(PrrtPace* pace) {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
if (pace->init) {
long long int effDelta_ns = timedelta(&now, &pace->lastStartTimestamp);
long long int maxDelta_ns = timedelta(&pace->lastStartTimestamp, &pace->lastEndTimestamp);
maxDelta_ns -= pace->totalPauseDuration_ns;
if(pace->first) {
PrrtPaceFilter_update(pace->effectivePace, (prrtTimedelta_t) MAX(0, round(effDelta_ns / 1000)));
PrrtPaceFilter_update(pace->maximumPace, (prrtTimedelta_t) MAX(0, round(maxDelta_ns / 1000)));
if (pace->initialized) {
long long int internalDelta_ns = timedelta(&pace->lastEndTimestamp, &pace->lastStartTimestamp);
long long int externalDelta_ns = timedelta(&now, &pace->lastEndTimestamp);
if (pace->firstRoundDone) {
PrrtPaceFilter_update(pace->internalPace, (prrtTimedelta_t) MAX(0, round(((double) internalDelta_ns) / 1000)));
PrrtPaceFilter_update(pace->externalPace, (prrtTimedelta_t) MAX(0, round(((double) externalDelta_ns) / 1000)));
PrrtPaceFilter_update(pace->dependentPace, (prrtTimedelta_t) MAX(0, round(((double) pace->totalPauseDuration_ns) / 1000)));
}
pace->first = true;
pace->firstRoundDone = true;
}
pace->totalPauseDuration_ns = 0;
pace->lastStartTimestamp = now;
pace->init = true;
pace->initialized = true;
}
void PrrtPace_track_end(PrrtPace* pace) {
clock_gettime(CLOCK_REALTIME, &pace->lastEndTimestamp);
......
......@@ -4,21 +4,27 @@
#include "paceFilter.h"
typedef struct prrtPace {
PrrtPaceFilter* effectivePace;
PrrtPaceFilter* maximumPace;
PrrtPaceFilter* internalPace;
PrrtPaceFilter* externalPace;
PrrtPaceFilter* dependentPace;
struct timespec lastStartTimestamp;
struct timespec lastEndTimestamp;
struct timespec lastPauseTimestamp;
prrtTimedelta_t totalPauseDuration_ns;
bool init;
bool first;
bool initialized;
bool firstRoundDone;
} PrrtPace;
PrrtPace* PrrtPace_create(void);
bool PrrtPace_destroy(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_eff(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_max(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_diff(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_internal(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_external(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_dependent(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_total(PrrtPace* pace);
prrtTimedelta_t PrrtPace_get_effective(PrrtPace* pace);
void PrrtPace_track_start(PrrtPace* pace);
void PrrtPace_track_end(PrrtPace* pace);
void PrrtPace_track_pause(PrrtPace* pace);
......
......@@ -186,38 +186,6 @@ cdef class PrrtSocket:
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "maximum_payload_size")
# Pacing
property app_send_max_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "app_send_max_pace") * 0.000001
property app_send_eff_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "app_send_eff_pace") * 0.000001
property prrt_transmit_max_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "prrt_transmit_max_pace") * 0.000001
property prrt_transmit_eff_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "prrt_transmit_eff_pace") * 0.000001
property prrt_receive_max_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "prrt_receive_max_pace") * 0.000001
property prrt_receive_eff_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "prrt_receive_eff_pace") * 0.000001
property app_deliver_max_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "app_deliver_max_pace") * 0.000001
property app_deliver_eff_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "app_deliver_eff_pace") * 0.000001
property nw_pace:
def __get__(self):
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "nw_pace") * 0.000001
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment