Commit 8e9b5f48 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add minimal commandline interface.

parent 37fe812c
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
# X-Lap: A Systems Approach for Cross-Layer Profiling and Latency Analysis for Cyber-Physical Networks


## How to use X-lap?

### Step 0: Define your relevant timestamps across a packet trace.
Define time- and cyclestamps:

* Where data enters the sender app.
* Where data leaves the sender app.
* Where data enters the receiver app.
* Where data leaves the receiver app.
* Define additional cyclestamps wherever appropriate.
* Define interesting durations inside xlap.yml.

### Step 1: Instrument your code and generate traces
* Define a Sender and Receiver Application (send arbitrary data around).
* Initialize the xlap facility.
* Add stamping code where-ever appropriate.
* There are different mechanisms for adding timestamps.


### Step 2: Use the provided xlap analysis tools
* Write your xlap.yml file as follows:

```yaml
data_files: ads
stamps: ads
durations: asd
```

* Run one of the following analyses on the data set:
    * Jitter Analysis (`jitter`)
+16 −2
Original line number Diff line number Diff line
import argparse
import yaml

from xlap.parse import evaluate
import xlap.analyse.jitter as jitter

tasks = {
    "jitter": None
}

def parse_config():
    contents = None
    with open("xlap.yml") as f:
@@ -11,7 +17,15 @@ def parse_config():
def main():
    config = parse_config()
    data_files = config["data_files"]
    df_data = evaluate(data_files["sender"], data_files["receiver"],kind=0)

    parser = argparse.ArgumentParser()
    parser.add_argument("tasks", metavar="T", type=str, nargs="+", help="analysis tasks to execute")
    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

        df_data = evaluate(data_files["sender"], data_files["receiver"],kind=0)
        jitter.analyse(df_data, config, "TraceJitter.pdf")