Difference of Average RTT among Subflows

Graph file: difference_rtt_sfs.py
Main fields:

conn.flows[*].attr[co.S2C][co.RTT_SAMPLES]  # Number of RTT samples collected by tstat
conn.flows[*].attr[co.S2C][co.RTT_AVG]      # Average RTT collected by tstat

Additional information

The algorithm can be summarized with this following code.

min_samples = 3
for conn_id, conn in multiflow_connections.iteritems():
    # Is the connection elligible for the graph?
    count_usable = 0
    for flow_id, flow in conn.flows.iteritems():
        if flow.attr[co.S2C][co.RTT_SAMPLES] >= min_samples:
            count_usable += 1

    if count_usable < 2:
        continue

    # Find best and worst subflows
    rtt_best_sf = float('inf')
    rtt_worst_sf = -1.0
    for flow_id, flow in conn.flows.iteritems():
        if flow.attr[co.S2C].get(co.RTT_SAMPLES, 0) >= min_samples:
            rtt_best_sf = min(rtt_best_sf, flow.attr[co.S2C][co.RTT_AVG])
            rtt_worst_sf = max(rtt_worst_sf, flow.attr[co.S2C][co.RTT_AVG])

    # Show the difference
    diff_rtt.append(rtt_worst_sf - rtt_best_sf)

RTT information is provided by tstat.
Notice that here, we only take into account subflows having at least
3 RTT estimations to avoid overestimating values.