Commit ccfecaef authored by Andreas Schmidt's avatar Andreas Schmidt

Calculating averaged RTT values at sender.

Distinguish between delay and app layer latency in evaluation scripts.
parent 7d401f41
......@@ -13,7 +13,7 @@ if __name__ == "__main__":
# TODO: support multiple tests via proper socket termination
setups = [
perf.TestSetup(packets=2**10,delay=0,loss=0.5,reorder=0,duplicate=0)
perf.TestSetup(packets=2**10,delay=0,loss=0,reorder=0,duplicate=0)
]
for setup in setups:
......
......@@ -14,6 +14,8 @@
#define N_START 7
#define N_P_START 1
#define RRT_ALPHA 0.125
// Uncomment the line below if you are compiling on Windows.
// #define WINDOWS
#include <stdio.h>
......
......@@ -26,6 +26,9 @@ PrrtSocket* PrrtSocket_create(const uint16_t port, const uint8_t is_sender) {
sock_ptr->sequenceNumberSource = 1;
sock_ptr->sequenceNumberRedundancy = 1;
sock_ptr->rttMean = 0;
sock_ptr->rttDev = 0;
sock_ptr->dataStore = NULL;
check(sock_ptr->dataSocketFd = socket(AF_INET, SOCK_DGRAM, 0), "Cannot create data socket.")
......@@ -253,7 +256,7 @@ int PrrtSocket_close(PrrtSocket *sock_ptr) {
return -1;
}
PrrtPacket *PrrtSocket_recv_feedback(const PrrtSocket *sock_ptr, const size_t length)
PrrtPacket *PrrtSocket_recv_feedback(PrrtSocket *sock_ptr, const size_t length)
{
char bufin[MAX_PAYLOAD_LENGTH];
ssize_t n;
......@@ -280,8 +283,10 @@ PrrtPacket *PrrtSocket_recv_feedback(const PrrtSocket *sock_ptr, const size_t le
PrrtPacket_decode(bufin, (uint16_t) n, packet_ptr);
PrrtPacketFeedbackPayload* feedbackPayload = packet_ptr->payload;
printf("FTT Timestamp: %d\n", feedbackPayload->forward_trip_timestamp);
printf("RTT: %d\n", receive_time - feedbackPayload->forward_trip_timestamp);
int32_t delta = (receive_time - feedbackPayload->forward_trip_timestamp) - sock_ptr->rttMean;
// TODO: ensure that there are no arithemtic problems via rounding etc.
sock_ptr->rttMean = (uint32_t) (sock_ptr->rttMean + RRT_ALPHA * delta);
sock_ptr->rttDev = (uint32_t) (sock_ptr->rttDev + RRT_ALPHA * (labs(delta) - sock_ptr->rttDev));
return packet_ptr;
......
......@@ -43,6 +43,9 @@ typedef struct prrtSocket {
uint32_t lastSentTimestamp;
uint32_t lastReceivedTimestamp;
uint32_t rttMean;
uint32_t rttDev;
} PrrtSocket;
......@@ -52,6 +55,6 @@ int PrrtSocket_close(PrrtSocket *sock_ptr);
int PrrtSocket_connect(PrrtSocket *sock_ptr, const char *host, const uint16_t port);
int PrrtSocket_send(PrrtSocket *sock_ptr, const uint8_t *data, const size_t data_len);
int32_t PrrtSocket_recv(PrrtSocket *sock_ptr, void *buf_ptr);
PrrtPacket *PrrtSocket_recv_feedback(const PrrtSocket *sock_ptr, const size_t length);
PrrtPacket *PrrtSocket_recv_feedback(PrrtSocket *sock_ptr, const size_t length);
#endif // PRRT_SOCKET_H
......@@ -72,7 +72,7 @@ class TestResults(object):
delayStd = np.std(delayValues) * 1000
delayMin = np.min(delayValues) * 1000
delayMax = np.max(delayValues) * 1000
delays = "Delay Profile [ms]: %f+-%f [%f - %f]" % (delayMean, delayStd, delayMin, delayMax)
delays = "Application Latency [ms]: %f+-%f [%f - %f]" % (delayMean, delayStd, delayMin, delayMax)
return "%s\n%s\n%s" % (loss, duplicates, delays)
class TestSetup(object):
......
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