common.py 580 Bytes
Newer Older
Andreas Schmidt's avatar
Andreas Schmidt committed
1
2
# TODO: Refactor.

3
4

def get_outlier_threshold(stats):
5
6
7
8
    q75 = stats["75%"]
    iqr = q75 - stats["25%"]
    return q75 + 1.5 * iqr

9

10
def _dn(x):
11
12
    return x + "_D"

13
14
15
16

def _filter(x, durations, source):
    return durations[x]["Source"] == source

17

18
19
20
21
22
23
def extract_durations(config):
    durations = config["durations"]

    durations_send = [_dn(x) for x in durations if _filter(x, durations, "sender")]
    durations_recv = [_dn(x) for x in durations if _filter(x, durations, "receiver")]

24
    return ["EndToEndTime", "Sender_D"] + durations_send + ["Receiver_D"] + durations_recv