Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
caf62602
Commit
caf62602
authored
Apr 27, 2018
by
Andreas Schmidt
Browse files
Estimating P_GG, P_BB, mu and rho.
parent
feadf321
Pipeline
#2246
failed with stages
in 51 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
prrt/cprrt.pxd
View file @
caf62602
...
...
@@ -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
)
...
...
prrt/proto/channelStateInformation.c
View file @
caf62602
#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
()
{
...
...
@@ -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
);
}
...
...
@@ -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
;
}
...
...
prrt/proto/channelStateInformation.h
View file @
caf62602
...
...
@@ -3,6 +3,7 @@
#include
<stdbool.h>
#include
"types/packet.h"
#include
"types/lossStatistics.h"
typedef
struct
prrtChannelStateInformation
{
pthread_mutex_t
lock
;
...
...
@@ -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
);
...
...
@@ -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
);
...
...
prrt/proto/processes/dataReceiver.c
View file @
caf62602
...
...
@@ -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:
...
...
prrt/proto/socket.c
View file @
caf62602
...
...
@@ -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
);
...
...
prrt/proto/socket.h
View file @
caf62602
...
...
@@ -131,6 +131,10 @@ prrtDeliveryRate_t PrrtSocket_get_delivery_rate_fwd(PrrtSocket *s);
prrtDeliveryRate_t
PrrtSocket_get_btlbw_fwd
(
PrrtSocket
*
s
);
prrtDeliveryRate_t
PrrtSocket_get_btlbw_back
(
PrrtSocket
*
s
);
bool
PrrtSocket_get_app_limited
(
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
);
char
*
PrrtSocket_inet_ntoa
(
struct
in_addr
*
in
);
uint16_t
PrrtSocket_ntohs
(
uint16_t
v
);
...
...
prrt/proto/stores/receptionTable.c
View file @
caf62602
...
...
@@ -8,7 +8,7 @@ PrrtReceptionTable *PrrtReceptionTable_create(void) {
check_mem
(
t
);
t
->
start
=
0
;
t
->
nextNumberAfterWindow
=
0
;
t
->
windowSize
=
10
00
;
t
->
windowSize
=
2
00
;
t
->
bitmap
=
Bitmap_create
(
false
,
SEQNO_SPACE
);
pthread_mutexattr_t
attr
;
...
...
prrt/proto/types/lossStatistics.h
View file @
caf62602
...
...
@@ -14,8 +14,8 @@ typedef struct lossStatistics {
PrrtLossStatistics
PrrtLossStatistics_add
(
PrrtLossStatistics
a
,
PrrtLossStatistics
b
);
#define LossStatistics_get_packet_loss_rate(stats) (((float) stats.erasureCount) / stats.packetCount)
#define LossStatistics_get_avg_gap_length(stats) (((float) stats.gapLength) / stats.gapCount)
#define LossStatistics_get_avg_burst_length(stats) (((float) stats.burstLength) / stats.burstCount)
#define
Prrt
LossStatistics_get_packet_loss_rate(stats) (((float) stats.erasureCount) / stats.packetCount)
#define
Prrt
LossStatistics_get_avg_gap_length(stats) (((float) stats.gapLength) / stats.gapCount)
#define
Prrt
LossStatistics_get_avg_burst_length(stats) (((float) stats.burstLength) / stats.burstCount)
#endif //PRRT_LOSS_STATISTICS_H
\ No newline at end of file
prrt/prrt.pyx
View file @
caf62602
...
...
@@ -253,6 +253,22 @@ cdef class PrrtSocket:
def
__get__
(
self
):
return
cprrt
.
PrrtSocket_get_app_limited
(
self
.
_c_socket
)
property
P_GG
:
def
__get__
(
self
):
return
cprrt
.
PrrtSocket_get_P_GG
(
self
.
_c_socket
)
property
P_BB
:
def
__get__
(
self
):
return
cprrt
.
PrrtSocket_get_P_BB
(
self
.
_c_socket
)
property
mu
:
def
__get__
(
self
):
return
cprrt
.
PrrtSocket_get_mu
(
self
.
_c_socket
)
property
rho
:
def
__get__
(
self
):
return
cprrt
.
PrrtSocket_get_rho
(
self
.
_c_socket
)
def
__dealloc__
(
self
):
if
self
.
_c_socket
!=
NULL
:
cprrt
.
PrrtSocket_close
(
self
.
_c_socket
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment