command_line.py 1.26 KB
Newer Older
1
import argparse
2
import yaml
3

4
5
6
from xlap.parse import evaluate
import xlap.analyse.jitter as jitter

7
8
9
10
tasks = {
    "jitter": None
}

11
12
13
14
15
16
17
18
19
20
def parse_config():
    contents = None
    with open("xlap.yml") as f:
        contents = f.read()
    return yaml.load(contents)

def main():
    config = parse_config()
    data_files = config["data_files"]

21
    parser = argparse.ArgumentParser()
Andreas Schmidt's avatar
Andreas Schmidt committed
22
23
    parser.add_argument("tasks", metavar="T", type=str, nargs="+", help="Analysis tasks to execute")
    parser.add_argument("-e", "--export", dest="export", action="store_true", default=False, help="Output pdf files.")
24
25
26
27
28
29
    args = parser.parse_args()

    for command in args.tasks:
        if command not in tasks.keys():
            print("{} is not a known analysis task.".format(command))
            continue
30

31
        df_data = evaluate(data_files["sender"], data_files["receiver"],kind=0)
Andreas Schmidt's avatar
Andreas Schmidt committed
32
33
34
35
36
37
38
39
40
41
42
43

        params = { "export": args.export}

        if command == "jitter":
            params1 = dict(params)
            params1.update({"file_name" : "TraceJitter.pdf"})
            params2 = dict(params)
            params2.update({"file_name" : "JitterCauses.pdf"})

            df = jitter.prep(df_data, config)
            jitter.trace_jitter(df, **params1)
            jitter.jitter_causes(df, **params2)