Skip to content

Commit 230b512

Browse files
committed
TODO: add debugging infos to understand the results :s
1 parent 4e5a708 commit 230b512

File tree

4 files changed

+54
-15
lines changed

4 files changed

+54
-15
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ See the [doc](http://mptcpanalyzer.readthedocs.io/en/latest/contributing.html).
170170
1. Why packets ids don't match the frame.number from my pcap ?
171171
mptcpanalyzer
172172

173-
173+
2. iperf3 reminder:
174+
Normally, the test data is sent from the client to the server, and measures the upload speed of the client.
174175

175176

176177

mptcpanalyzer/cli.py

+20-9
Original file line numberDiff line numberDiff line change
@@ -671,18 +671,21 @@ def do_summary_extended(self, args, unknown):
671671
df_pcap1 = load_into_pandas(args.pcap1, self.tshark_config)
672672

673673
# to abstract things a bit
674-
# destinations = [ ConnectionRoles.Server ];
675-
destinations = args.pcap_destinations
674+
# TODO revert
675+
destinations = [ ConnectionRoles.Server ];
676+
print("test %r" % type(destinations[0]))
677+
# destinations = args.pcap_destinations
676678
# or list(mp.ConnectionRoles)
677679

678680
print("NANI ? %r" % destinations )
679681
for destination in destinations:
680-
basic_stats = mptcp_compute_throughput(
681-
# TODO here we should load the pcap before hand !
682-
df_pcap1,
683-
args.pcap1stream,
684-
destination,
685-
)
682+
# will create problems
683+
# basic_stats = mptcp_compute_throughput(
684+
# # TODO here we should load the pcap before hand !
685+
# df_pcap1,
686+
# args.pcap1stream,
687+
# destination,
688+
# )
686689

687690
# TODO already be done BUT NOT THE CASE FOR GOD's SAKE !
688691
# TODO we should have the parser do it
@@ -695,6 +698,14 @@ def do_summary_extended(self, args, unknown):
695698
self.tshark_config
696699
)
697700

701+
debug_dataframe(df, "checking just after merge", ) # usecols=["tcpdest", "mptcpdest"])
702+
basic_stats = mptcp_compute_throughput(
703+
# TODO here we should load the pcap before hand !
704+
df,
705+
args.pcap1stream,
706+
destination,
707+
)
708+
698709
# also here the dest are wrong
699710

700711

@@ -719,7 +730,7 @@ def do_summary_extended(self, args, unknown):
719730
total_transferred = stats.mptcp_throughput_bytes
720731
msg = ("mptcpstream {c.mptcpstreamid} towards {destination} forwarded "
721732
"{c.mptcp_throughput_bytes} bytes with a goodput of {c.mptcp_goodput_bytes}")
722-
self.poutput(msg.format(c=stats, destination=destination))
733+
self.poutput(msg.format(c=stats, destination=destination.name))
723734

724735
for subflow in stats.subflow_stats:
725736

mptcpanalyzer/data.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
# TODO might need a converter when saving/loading
2828
# TODO pandas.api.types.register_extension_dtype()
29-
dtype_role = pd.api.types.CategoricalDtype(categories=ConnectionRoles, ordered=True)
29+
# the list here is important in fact
30+
dtype_role = pd.api.types.CategoricalDtype(categories=list(ConnectionRoles), ordered=True)
3031

3132
TCP_DEBUG_FIELDS = ['hash', 'packetid', "reltime", "abstime"]
3233
MPTCP_DEBUG_FIELDS = TCP_DEBUG_FIELDS + ['mptcpdest']
@@ -124,6 +125,22 @@ class PacketMappingMode(Enum):
124125
SCORE = auto()
125126

126127

128+
def check_df(f, checks):
129+
'''
130+
decorator checking that dataframe fulfill some conditions
131+
first argument (dataframe)
132+
'''
133+
# TODO
134+
@functools.wraps(f)
135+
def wrapped(self, *args):
136+
if self.data is not None:
137+
return f(self, *args)
138+
else:
139+
raise mp.MpTcpException("Please load a pcap with `load_pcap` first")
140+
return None
141+
return wrapped
142+
143+
127144
def drop_syn(df: pd.DataFrame, mptcp: bool = True) -> pd.DataFrame:
128145
"""
129146
for mptcp it's as easy as removing packets with MP_CAPABLE or MP_JOIN
@@ -703,7 +720,7 @@ def merge_tcp_dataframes_known_streams(
703720
log.debug("Setting mptcpdest to %s" % mptcpdest)
704721
# if tcpdest == main_connection.mptcpdest
705722

706-
debug_dataframe(total, "concanated df", usecols=["tcpdest", "mptcpdest"])
723+
debug_dataframe(total, "concanated df", ) # usecols=["tcpdest", "mptcpdest"])
707724
# TODO here we should
708725
total = pd.concat([res, total])
709726

mptcpanalyzer/statistics.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,19 @@ def tcp_get_stats(
6464
destination: ConnectionRoles,
6565
mptcp=False
6666
):
67+
'''
68+
Expects df to have tcpdest set
69+
'''
6770
# -> Tuple[TcpUnidirectionalStats, TcpUnidirectionalStats]:
6871
log.debug("Getting TCP stats for stream %d" % tcpstreamid)
72+
assert destination in ConnectionRoles, "destination is %r" % type(destination)
73+
6974
df = rawdf[rawdf.tcpstream == tcpstreamid]
7075
if df.empty:
7176
raise MpTcpException("No packet with tcp.stream == %d" % tcpstreamid)
7277

78+
# TODO do it only when needed
7379
con = TcpConnection.build_from_dataframe(df, tcpstreamid)
74-
7580
df2 = tcpdest_from_connections(df, con)
7681

7782
log.debug("df2 size = %d" % len(df2))
@@ -96,6 +101,8 @@ def tcp_get_stats(
96101

97102
# -1 to accoutn for SYN
98103
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+
99106

100107
# if mptcp:
101108
# print("do some extra work")
@@ -119,6 +126,7 @@ def mptcp_compute_throughput(
119126
Returns:
120127
a tuple (True/false, dict)
121128
"""
129+
assert isinstance(destination, ConnectionRoles), "destination is %r" % destination
122130

123131
df = rawdf[rawdf.mptcpstream == mptcpstreamid]
124132
if df.empty:
@@ -134,6 +142,8 @@ def mptcp_compute_throughput(
134142
# -1 because of syn
135143
dsn_range = dsn_max - dsn_min - 1
136144

145+
log.debug("tcp_goodput ({}) = {} (seq_max) - {} (seq_min) - 1".format(tcp_goodput, seq_max, seq_min))
146+
137147
# Could groupby destination as well
138148
d = df.groupby(_sender('tcpstream'))
139149
subflow_stats: List[TcpUnidirectionalStats] = []
@@ -142,7 +152,7 @@ def mptcp_compute_throughput(
142152
debug_dataframe(subdf, "subdf for stream %d" % tcpstream)
143153
dest = subdf.iloc[0, subdf.columns.get_loc(_sender('tcpdest'))]
144154
sf_stats = tcp_get_stats(subdf, tcpstream,
145-
dest,
155+
ConnectionRoles(dest),
146156
True)
147157

148158
# TODO drop retransmitted
@@ -178,7 +188,7 @@ def mptcp_compute_throughput_extended(
178188
Should display goodput
179189
"""
180190
assert isinstance(destination, ConnectionRoles)
181-
log.debug("Looking at destination ", destination)
191+
log.debug("Looking at destination %s" % destination)
182192
df_both = classify_reinjections(rawdf)
183193

184194
df = df_both[df_both.mptcpdest == destination]

0 commit comments

Comments
 (0)