@@ -64,14 +64,19 @@ def tcp_get_stats(
64
64
destination : ConnectionRoles ,
65
65
mptcp = False
66
66
):
67
+ '''
68
+ Expects df to have tcpdest set
69
+ '''
67
70
# -> Tuple[TcpUnidirectionalStats, TcpUnidirectionalStats]:
68
71
log .debug ("Getting TCP stats for stream %d" % tcpstreamid )
72
+ assert destination in ConnectionRoles , "destination is %r" % type (destination )
73
+
69
74
df = rawdf [rawdf .tcpstream == tcpstreamid ]
70
75
if df .empty :
71
76
raise MpTcpException ("No packet with tcp.stream == %d" % tcpstreamid )
72
77
78
+ # TODO do it only when needed
73
79
con = TcpConnection .build_from_dataframe (df , tcpstreamid )
74
-
75
80
df2 = tcpdest_from_connections (df , con )
76
81
77
82
log .debug ("df2 size = %d" % len (df2 ))
@@ -96,6 +101,8 @@ def tcp_get_stats(
96
101
97
102
# -1 to accoutn for SYN
98
103
tcp_goodput = seq_max - seq_min - 1
104
+ log .debug ("tcp_goodput ({}) = {} (seq_max) - {} (seq_min) - 1" .format (tcp_goodput , seq_max , seq_min ))
105
+
99
106
100
107
# if mptcp:
101
108
# print("do some extra work")
@@ -119,6 +126,7 @@ def mptcp_compute_throughput(
119
126
Returns:
120
127
a tuple (True/false, dict)
121
128
"""
129
+ assert isinstance (destination , ConnectionRoles ), "destination is %r" % destination
122
130
123
131
df = rawdf [rawdf .mptcpstream == mptcpstreamid ]
124
132
if df .empty :
@@ -134,6 +142,8 @@ def mptcp_compute_throughput(
134
142
# -1 because of syn
135
143
dsn_range = dsn_max - dsn_min - 1
136
144
145
+ log .debug ("tcp_goodput ({}) = {} (seq_max) - {} (seq_min) - 1" .format (tcp_goodput , seq_max , seq_min ))
146
+
137
147
# Could groupby destination as well
138
148
d = df .groupby (_sender ('tcpstream' ))
139
149
subflow_stats : List [TcpUnidirectionalStats ] = []
@@ -142,7 +152,7 @@ def mptcp_compute_throughput(
142
152
debug_dataframe (subdf , "subdf for stream %d" % tcpstream )
143
153
dest = subdf .iloc [0 , subdf .columns .get_loc (_sender ('tcpdest' ))]
144
154
sf_stats = tcp_get_stats (subdf , tcpstream ,
145
- dest ,
155
+ ConnectionRoles ( dest ) ,
146
156
True )
147
157
148
158
# TODO drop retransmitted
@@ -178,7 +188,7 @@ def mptcp_compute_throughput_extended(
178
188
Should display goodput
179
189
"""
180
190
assert isinstance (destination , ConnectionRoles )
181
- log .debug ("Looking at destination " , destination )
191
+ log .debug ("Looking at destination %s" % destination )
182
192
df_both = classify_reinjections (rawdf )
183
193
184
194
df = df_both [df_both .mptcpdest == destination ]
0 commit comments