diff --git a/prrt/cprrt.pxd b/prrt/cprrt.pxd index 1efbd8b2a00c09910bc1ea6076588fa191882f15..d28e9d7f55a4a3c98ee2975dc90a2d01ac832b10 100644 --- a/prrt/cprrt.pxd +++ b/prrt/cprrt.pxd @@ -1,6 +1,6 @@ include "posix/time.pxd" -from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t +from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t, uint64_t from libc.string cimport const_char cdef extern from "pthread.h" nogil: @@ -147,6 +147,10 @@ cdef extern from "proto/socket.h": float PrrtSocket_get_plr(PrrtSocket *socket) uint32_t PrrtSocket_get_delivery_rate(PrrtSocket *socket) uint32_t PrrtSocket_get_btlbw(PrrtSocket *socket) + uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s) + uint64_t PrrtSocket_get_full_bw(PrrtSocket *s) + bint PrrtSocket_get_filled_pipe(PrrtSocket *s) + bint PrrtSocket_get_app_limited(PrrtSocket *socket) bint PrrtSocket_enable_thread_pinning(PrrtSocket *socket) diff --git a/prrt/proto/bbr.c b/prrt/proto/bbr.c index 877be79242e5536ed42c9476866b5969f0dbb97a..4b330d1b44df0789ea5837a5b4854b175fb19f52 100644 --- a/prrt/proto/bbr.c +++ b/prrt/proto/bbr.c @@ -9,7 +9,7 @@ uint32_t BBR_Inflight(BBR* bbr, float gain) if (bbr->rtprop == Inf) return InitialCwnd; /* no valid RTT samples yet */ uint32_t quanta = 3 * bbr->send_quantum; - uint32_t estimated_bdp = bbr->bw * bbr->rtprop; + uint32_t estimated_bdp = (bbr->bw * bbr->rtprop) / (1000 * 1000 * 8); return (uint32_t)(gain * estimated_bdp + quanta); } @@ -30,7 +30,7 @@ void BBR_UpdateBtlBw(BBR* bbr, PrrtRateSample* rs, prrtByteCount_t packet_delive bbr->round_start = false; } if ((rs->delivery_rate >= bbr->bw || !rs->is_app_limited) && rs->delivery_rate != 0) { - bbr->bw = (uint32_t)WindowedFilter_push(bbr->btlBwFilter, (uint32_t)rs->delivery_rate); + bbr->bw = (uint32_t)WindowedFilter_push(bbr->btlBwFilter, (uint32_t)(rs->delivery_rate)); debug(DEBUG_BBR, "Current BtlBw: %u, RS delivery rate: %u", bbr->bw, (uint32_t)rs->delivery_rate); } } @@ -197,7 +197,7 @@ void BBR_SetCwnd(BBR* bbr, PrrtPacketTracking* packetTracking) void BBR_SetPacingRateWithGain(BBR* bbr, float pacing_gain) { - uint32_t rate = (uint32_t) (pacing_gain * (float)bbr->bw); + uint32_t rate = (uint32_t) (pacing_gain * ((float)bbr->bw) / (1000*1000*8)); debug(DEBUG_BBR, "Current rate: %u, Pacing gain: %f, BtlBw: %u, Calc Rate: %u, Filled pipe: %u", bbr->pacing_rate, pacing_gain, bbr->bw, rate, bbr->filled_pipe); if (rate != 0 && (bbr->filled_pipe || rate > bbr->pacing_rate)) @@ -277,4 +277,17 @@ prrtDeliveryRate_t BBR_getBtlBw(BBR* bbr) uint32_t BBR_getRTProp(BBR* bbr) { return bbr->rtprop; -} \ No newline at end of file +} + +uint32_t BBR_getState(BBR* bbr) { + return bbr->state; +} + +bool BBR_getFilledPipe(BBR* bbr) { + return bbr->filled_pipe; +} + +uint64_t BBR_getFullBw(BBR* bbr) { + return bbr->full_bw; +} + diff --git a/prrt/proto/bbr.h b/prrt/proto/bbr.h index 8c9277dfcace42e8209532941415fbd3ae58a403..e11694becef8a6c139593202250e18c43e0fb523 100644 --- a/prrt/proto/bbr.h +++ b/prrt/proto/bbr.h @@ -78,6 +78,9 @@ void BBR_destroy(BBR* bbr); uint32_t BBR_getPacingRate(BBR* bbr); uint32_t BBR_getCwnd(BBR* bbr); prrtDeliveryRate_t BBR_getBtlBw(BBR* bbr); +uint32_t BBR_getState(BBR* bbr); +uint64_t BBR_getFullBw(BBR* bbr); +bool BBR_getFilledPipe(BBR* bbr); uint32_t BBR_getRTProp(BBR* bbr); #endif //PRRT_BBR_H diff --git a/prrt/proto/receiver.c b/prrt/proto/receiver.c index 3f0136bf2fe24c44970cd43867a5f94ac6c0325e..17b010e05cdba044cd15a9d9074f0cdb50e7d385 100644 --- a/prrt/proto/receiver.c +++ b/prrt/proto/receiver.c @@ -173,6 +173,7 @@ bool PrrtReceiver_updateAndGenerateRateSample(PrrtReceiver *recv, prrtSequenceNu pthread_cond_wait(&recv->recordNotFoundCv, &recv->lock); packet = PrrtInFlightPacketStore_get_packet(inflightPacketStore, seqnum); } + recv->packetTracking->bytes_delivered = packet->delivered; PrrtReceiver_updateRateSample(recv->rateSample, packet, receiveTime, recv->packetTracking); @@ -185,7 +186,7 @@ bool PrrtReceiver_updateAndGenerateRateSample(PrrtReceiver *recv, prrtSequenceNu recv->packetTracking->packets_delivered++; recv->packetTracking->packets_in_flight = (prrtSequenceNumber_t) (PrrtInFlightPacketStore_get_queue_size(recv->dataInflightPacketStore) + PrrtInFlightPacketStore_get_queue_size(recv->redundancyInflightPacketStore)); recv->packetTracking->prior_inflight = recv->packetTracking->packets_in_flight; - if(recv->rateSample != NULL) { + if(recv->rateSample != NULL && result) { BBR_OnACK(recv->bbr, recv->csi, recv->rateSample, recv->packetTracking); } return result; diff --git a/prrt/proto/socket.c b/prrt/proto/socket.c index 104893be062f9dd936bc01a6e135b7d2c359f0be..1211b1554520df74e92e6e4b3556b92828bb7923 100644 --- a/prrt/proto/socket.c +++ b/prrt/proto/socket.c @@ -586,7 +586,7 @@ bool PrrtSocket_uses_thread_pinning(PrrtSocket *s) { } uint32_t PrrtSocket_get_rtprop(PrrtSocket *s) { - return PrrtChannelStateInformation_get_rtprop(s->receiver->csi); + return BBR_getRTProp(s->receiver->bbr); } prrtPacketLossRate_t PrrtSocket_get_plr(PrrtSocket *s) { @@ -601,6 +601,20 @@ prrtDeliveryRate_t PrrtSocket_get_btlbw(PrrtSocket *s) { return BBR_getBtlBw(s->receiver->bbr); } +uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s) { + return BBR_getState(s->receiver->bbr); +} + + +bool PrrtSocket_get_filled_pipe(PrrtSocket *s) { + return BBR_getFilledPipe(s->receiver->bbr); +} + +uint64_t PrrtSocket_get_full_bw(PrrtSocket *s) { + return BBR_getFullBw(s->receiver->bbr); +} + + bool PrrtSocket_get_app_limited(PrrtSocket *s) { return PrrtChannelStateInformation_get_app_limited(s->receiver->csi); } diff --git a/prrt/proto/socket.h b/prrt/proto/socket.h index 642fd6c2072f62e5aa18b515a914cffe0a2dbd33..b5314c7817c0f2af758c03ba0378c7cc0e49b80d 100644 --- a/prrt/proto/socket.h +++ b/prrt/proto/socket.h @@ -134,6 +134,9 @@ uint32_t PrrtSocket_get_rtprop(PrrtSocket *s); prrtPacketLossRate_t PrrtSocket_get_plr(PrrtSocket *s); prrtDeliveryRate_t PrrtSocket_get_delivery_rate(PrrtSocket *s); prrtDeliveryRate_t PrrtSocket_get_btlbw(PrrtSocket *s); +uint64_t PrrtSocket_get_full_bw(PrrtSocket *s); +bool PrrtSocket_get_filled_pipe(PrrtSocket *s); +uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s); bool PrrtSocket_get_app_limited(PrrtSocket *s); #endif // PRRT_SOCKET_H diff --git a/prrt/prrt.pyx b/prrt/prrt.pyx index d03826637a3f0bf2d510d920de5a9bf897e830c5..ad2e352870d573114396e69562c0687b7602dd91 100644 --- a/prrt/prrt.pyx +++ b/prrt/prrt.pyx @@ -192,6 +192,24 @@ cdef class PrrtSocket: raise Exception("Not a sender.") return cprrt.PrrtSocket_get_btlbw(self._c_socket) + property bbr_state: + def __get__(self): + if not self.isSender: + raise Exception("Not a sender.") + return cprrt.PrrtSocket_get_bbr_state(self._c_socket) + + property bbr_filled_pipe: + def __get__(self): + if not self.isSender: + raise Exception("Not a sender.") + return cprrt.PrrtSocket_get_filled_pipe(self._c_socket) + + property bbr_full_bw: + def __get__(self): + if not self.isSender: + raise Exception("Not a sender.") + return cprrt.PrrtSocket_get_full_bw(self._c_socket) + property app_limited: def __get__(self): if not self.isSender: