Loading prrt/cprrt.pxd +5 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,11 @@ cdef extern from "proto/socket.h": uint32_t PrrtSocket_get_btlbw_fwd(PrrtSocket *s); uint32_t PrrtSocket_get_btlbw_back(PrrtSocket *s); double PrrtSocket_get_P_GG(PrrtSocket *s); double PrrtSocket_get_P_BB(PrrtSocket *s); double PrrtSocket_get_mu(PrrtSocket *s); double PrrtSocket_get_rho(PrrtSocket *s); bint PrrtSocket_get_app_limited(PrrtSocket *socket) bint PrrtSocket_enable_thread_pinning(PrrtSocket *socket) Loading prrt/proto/channelStateInformation.c +26 −4 Original line number Diff line number Diff line #include <stdlib.h> #include <math.h> #include "../defines.h" #include "../util/common.h" #include "../util/dbg.h" #include "channelStateInformation.h" #include "clock.h" #include "receiver.h" #include "channelStateInformation.h" PrrtChannelStateInformation * PrrtChannelStateInformation_create() { Loading Loading @@ -44,10 +45,15 @@ void PrrtChannelStateInformation_update_rtprop(PrrtChannelStateInformation *csi, pthread_mutex_unlock(&csi->lock); } void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures, prrtSequenceNumber_t packets) { void PrrtChannelStateInformation_update_loss_information(PrrtChannelStateInformation *csi, PrrtLossStatistics stats) { pthread_mutex_lock(&csi->lock); csi->plr = ((float) erasures) / packets; csi->plr = PrrtLossStatistics_get_packet_loss_rate(stats); float L_B = PrrtLossStatistics_get_avg_burst_length(stats); csi->P_GG = (isnan(L_B)) ? 0 : 1 - (1.0 / L_B); float L_G = PrrtLossStatistics_get_avg_gap_length(stats); csi->P_BB = (isnan(L_G)) ? 0 : 1 - (1.0 / L_G); csi->mu = (1 - csi->P_BB) / (2 - csi->P_GG - csi->P_BB); csi->rho = csi->P_GG + csi->P_BB - 1; pthread_mutex_unlock(&csi->lock); } Loading Loading @@ -84,6 +90,22 @@ prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInforma return csi->plr; } double PrrtChannelStateInformation_get_P_GG(PrrtChannelStateInformation *csi) { return csi->P_GG; } double PrrtChannelStateInformation_get_P_BB(PrrtChannelStateInformation *csi) { return csi->P_BB; } double PrrtChannelStateInformation_get_mu(PrrtChannelStateInformation *csi) { return csi->mu; } double PrrtChannelStateInformation_get_rho(PrrtChannelStateInformation *csi) { return csi->rho; } prrtDeliveryRate_t PrrtChannelStateInformation_get_delivery_rate(PrrtChannelStateInformation *csi) { return csi->deliveryRate; } Loading prrt/proto/channelStateInformation.h +10 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ #include <stdbool.h> #include "types/packet.h" #include "types/lossStatistics.h" typedef struct prrtChannelStateInformation { pthread_mutex_t lock; Loading @@ -23,6 +24,10 @@ typedef struct prrtChannelStateInformation { uint8_t btlbw_filter_length; bool appLimited; double P_GG; double P_BB; double mu; double rho; } PrrtChannelStateInformation; PrrtChannelStateInformation* PrrtChannelStateInformation_create(void); Loading @@ -33,11 +38,14 @@ prrtDeliveryRate_t PrrtChannelStateInformation_get_btlbw(PrrtChannelStateInforma bool PrrtChannelStateInformation_get_app_limited(PrrtChannelStateInformation *csi); prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation* csi); void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures, prrtSequenceNumber_t packets); void PrrtChannelStateInformation_update_loss_information(PrrtChannelStateInformation *csi, PrrtLossStatistics stats); void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, PrrtPacket* packet, prrtDeliveryRate_t rate); void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited); bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation* csi); double PrrtChannelStateInformation_get_P_GG(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_P_BB(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_mu(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_rho(PrrtChannelStateInformation *csi); void PrrtChannelStateInformation_print(PrrtChannelStateInformation *csi); Loading prrt/proto/processes/dataReceiver.c +10 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,16 @@ void handle_feedback_packet(PrrtSocket *prrtSocket, PrrtPacket *prrtPacket, prrt PrrtChannelStateInformation_update_rtprop(prrtSocket->receiver->csi, (prrtTimedelta_t) (receiveTime - forwardTripTimestamp)); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_rtprop "); PrrtChannelStateInformation_update_plr(prrtSocket->receiver->csi, feedbackPayload->erasureCount, feedbackPayload->packetCount); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_plr "); PrrtLossStatistics stats = { .burstCount = feedbackPayload->burstCount, .burstLength = feedbackPayload->burstLength, .erasureCount = feedbackPayload->erasureCount, .gapCount = feedbackPayload->gapCount, .gapLength = feedbackPayload->gapLength, .packetCount = feedbackPayload->packetCount }; PrrtChannelStateInformation_update_loss_information(prrtSocket->receiver->csi, stats); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_loss_information "); return; error: Loading prrt/proto/socket.c +15 −0 Original line number Diff line number Diff line Loading @@ -532,6 +532,21 @@ prrtDeliveryRate_t PrrtSocket_get_btlbw_back(PrrtSocket *s) { return 0; } double PrrtSocket_get_P_GG(PrrtSocket *s) { return PrrtChannelStateInformation_get_P_GG(s->receiver->csi); } double PrrtSocket_get_P_BB(PrrtSocket *s) { return PrrtChannelStateInformation_get_P_BB(s->receiver->csi); } double PrrtSocket_get_mu(PrrtSocket *s) { return PrrtChannelStateInformation_get_mu(s->receiver->csi); } double PrrtSocket_get_rho(PrrtSocket *s) { return PrrtChannelStateInformation_get_rho(s->receiver->csi); } bool PrrtSocket_get_app_limited(PrrtSocket *s) { return PrrtChannelStateInformation_get_app_limited(s->receiver->csi); Loading Loading
prrt/cprrt.pxd +5 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,11 @@ cdef extern from "proto/socket.h": uint32_t PrrtSocket_get_btlbw_fwd(PrrtSocket *s); uint32_t PrrtSocket_get_btlbw_back(PrrtSocket *s); double PrrtSocket_get_P_GG(PrrtSocket *s); double PrrtSocket_get_P_BB(PrrtSocket *s); double PrrtSocket_get_mu(PrrtSocket *s); double PrrtSocket_get_rho(PrrtSocket *s); bint PrrtSocket_get_app_limited(PrrtSocket *socket) bint PrrtSocket_enable_thread_pinning(PrrtSocket *socket) Loading
prrt/proto/channelStateInformation.c +26 −4 Original line number Diff line number Diff line #include <stdlib.h> #include <math.h> #include "../defines.h" #include "../util/common.h" #include "../util/dbg.h" #include "channelStateInformation.h" #include "clock.h" #include "receiver.h" #include "channelStateInformation.h" PrrtChannelStateInformation * PrrtChannelStateInformation_create() { Loading Loading @@ -44,10 +45,15 @@ void PrrtChannelStateInformation_update_rtprop(PrrtChannelStateInformation *csi, pthread_mutex_unlock(&csi->lock); } void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures, prrtSequenceNumber_t packets) { void PrrtChannelStateInformation_update_loss_information(PrrtChannelStateInformation *csi, PrrtLossStatistics stats) { pthread_mutex_lock(&csi->lock); csi->plr = ((float) erasures) / packets; csi->plr = PrrtLossStatistics_get_packet_loss_rate(stats); float L_B = PrrtLossStatistics_get_avg_burst_length(stats); csi->P_GG = (isnan(L_B)) ? 0 : 1 - (1.0 / L_B); float L_G = PrrtLossStatistics_get_avg_gap_length(stats); csi->P_BB = (isnan(L_G)) ? 0 : 1 - (1.0 / L_G); csi->mu = (1 - csi->P_BB) / (2 - csi->P_GG - csi->P_BB); csi->rho = csi->P_GG + csi->P_BB - 1; pthread_mutex_unlock(&csi->lock); } Loading Loading @@ -84,6 +90,22 @@ prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInforma return csi->plr; } double PrrtChannelStateInformation_get_P_GG(PrrtChannelStateInformation *csi) { return csi->P_GG; } double PrrtChannelStateInformation_get_P_BB(PrrtChannelStateInformation *csi) { return csi->P_BB; } double PrrtChannelStateInformation_get_mu(PrrtChannelStateInformation *csi) { return csi->mu; } double PrrtChannelStateInformation_get_rho(PrrtChannelStateInformation *csi) { return csi->rho; } prrtDeliveryRate_t PrrtChannelStateInformation_get_delivery_rate(PrrtChannelStateInformation *csi) { return csi->deliveryRate; } Loading
prrt/proto/channelStateInformation.h +10 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ #include <stdbool.h> #include "types/packet.h" #include "types/lossStatistics.h" typedef struct prrtChannelStateInformation { pthread_mutex_t lock; Loading @@ -23,6 +24,10 @@ typedef struct prrtChannelStateInformation { uint8_t btlbw_filter_length; bool appLimited; double P_GG; double P_BB; double mu; double rho; } PrrtChannelStateInformation; PrrtChannelStateInformation* PrrtChannelStateInformation_create(void); Loading @@ -33,11 +38,14 @@ prrtDeliveryRate_t PrrtChannelStateInformation_get_btlbw(PrrtChannelStateInforma bool PrrtChannelStateInformation_get_app_limited(PrrtChannelStateInformation *csi); prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation* csi); void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures, prrtSequenceNumber_t packets); void PrrtChannelStateInformation_update_loss_information(PrrtChannelStateInformation *csi, PrrtLossStatistics stats); void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, PrrtPacket* packet, prrtDeliveryRate_t rate); void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited); bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation* csi); double PrrtChannelStateInformation_get_P_GG(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_P_BB(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_mu(PrrtChannelStateInformation *csi); double PrrtChannelStateInformation_get_rho(PrrtChannelStateInformation *csi); void PrrtChannelStateInformation_print(PrrtChannelStateInformation *csi); Loading
prrt/proto/processes/dataReceiver.c +10 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,16 @@ void handle_feedback_packet(PrrtSocket *prrtSocket, PrrtPacket *prrtPacket, prrt PrrtChannelStateInformation_update_rtprop(prrtSocket->receiver->csi, (prrtTimedelta_t) (receiveTime - forwardTripTimestamp)); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_rtprop "); PrrtChannelStateInformation_update_plr(prrtSocket->receiver->csi, feedbackPayload->erasureCount, feedbackPayload->packetCount); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_plr "); PrrtLossStatistics stats = { .burstCount = feedbackPayload->burstCount, .burstLength = feedbackPayload->burstLength, .erasureCount = feedbackPayload->erasureCount, .gapCount = feedbackPayload->gapCount, .gapLength = feedbackPayload->gapLength, .packetCount = feedbackPayload->packetCount }; PrrtChannelStateInformation_update_loss_information(prrtSocket->receiver->csi, stats); debug(DEBUG_DATARECEIVER, "PrrtChannelStateInformation_update_loss_information "); return; error: Loading
prrt/proto/socket.c +15 −0 Original line number Diff line number Diff line Loading @@ -532,6 +532,21 @@ prrtDeliveryRate_t PrrtSocket_get_btlbw_back(PrrtSocket *s) { return 0; } double PrrtSocket_get_P_GG(PrrtSocket *s) { return PrrtChannelStateInformation_get_P_GG(s->receiver->csi); } double PrrtSocket_get_P_BB(PrrtSocket *s) { return PrrtChannelStateInformation_get_P_BB(s->receiver->csi); } double PrrtSocket_get_mu(PrrtSocket *s) { return PrrtChannelStateInformation_get_mu(s->receiver->csi); } double PrrtSocket_get_rho(PrrtSocket *s) { return PrrtChannelStateInformation_get_rho(s->receiver->csi); } bool PrrtSocket_get_app_limited(PrrtSocket *s) { return PrrtChannelStateInformation_get_app_limited(s->receiver->csi); Loading