Commit 00888d45 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add a method to automatically generate the capturing header for xlap.

parent 83a33a6f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@ durations:
        Start: StampC
        Stop: StampD
        Source: receiver
packet_types:
    Data: 0
    Ack: 1
```

* You can run a jitter analysis via `xlap jitter`. The parameter `-e` exports the diagrams as `pdf`.
+3 −0
Original line number Diff line number Diff line
@@ -129,3 +129,6 @@ durations:
        Start: DecodeStart
        Stop: DecodeEnd
        Source: receiver
packet_types:
    Data: 0
    Redundancy: 1
+29 −11
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ from xlap.parse import evaluate, parse_config
import xlap.analyse.jitter as jitter

tasks = {
    "jitter": None
    "jitter": None,
    "capture": None
}


@@ -22,6 +23,23 @@ def main():
            print("{} is not a known analysis task.".format(command))
            continue

        if command == "capture":
            types = ",\n".join(["     ts_{}_packet = {}".format(k.lower(),v) for k,v in config["packet_types"].items()])

            typedef = "typedef enum XlapTimestampPacketKind {{\n{}\n}} XlapTimestampPacketKind".format(types)

            timestamp = "#define TIMESTAMP_ID_LIST \\\n"
            timestamp += ", \\\n".join([" " * 8 + x for x in config["stamps"].keys()])

            output = "#ifndef {0}\n#define {0}\n\n{1}\n\n{2}\n\n#endif // {0}".format("XLAP_CAPTURE_H", typedef, timestamp)

            if args.export:
                with open("xlap_capture.h", "w") as f:
                    f.write(output)
                    f.write("\n")
            else:
                print(output)
        else:
            df_data = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=0)

            params = {"export": args.export}