Commit cdb8a8c6 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Improved README, example notebook. Added interaction for traces.

parent e9da367f
# X-Lap: A Systems Approach for Cross-Layer Profiling and Latency Analysis for Cyber-Physical Networks # X-Lap: A Systems Approach for Cross-Layer Profiling and Latency Analysis for Cyber-Physical Networks
## Conventions ## How to install X-Lap?
* Stampnames:
`_T`: Timestamp (us precision)
`_C`: Clockstamp
`_D`: Duration (us precision)
* Reserved Names:
* `Channel`
* `Sender`
* `Receiver`
* `EndToEnd`
Enter the project directory and type `python setup.py install` to install `xlap` on your system.
## How to use X-lap? ## How to use X-lap?
...@@ -36,13 +24,69 @@ Define time- and cyclestamps: ...@@ -36,13 +24,69 @@ Define time- and cyclestamps:
### Step 2: Use the provided xlap analysis tools ### Step 2: Use the provided xlap analysis tools
* Write your xlap.yml file as follows: * Write your `xlap.yml` file as follows:
```yaml ```yml
data_files: ads data_files:
stamps: ads sender: sender.csv
durations: asd receiver: receiver.csv
cycle_reference:
sender: StampA
receiver: SampB
time_reference:
sender: StampC
receiver: StampE
stamps:
StampA:
Source: receiver
Type: time
StampB:
Source: receiver
Type: time
StampC:
Source: receiver
Type: time
StampD:
Source: receiver
Type: cycle
StampE:
Source: receiver
Type: time
durations:
DurationA:
Start: StampA
Stop: StampB
Source: sender
DurationB:
Start: StampC
Stop: StampD
Source: receiver
``` ```
* Run one of the following analyses on the data set: * You can run a jitter analysis via `xlap jitter`. The parameter `-e` exports the diagrams as `pdf`.
* Jitter Analysis (`jitter`)
* The best way to interact with `xlap` is through a [Jupyter Python 3 Notebook](http://jupyter.org/). An example can be found in `notebook.ipynb`.
* `xlap.analyse.trace.traces()` can be used to investigate individual packet traces.
## Conventions
* Suffixes (indicate type):
* `_T`: Timestamp (us precision)
* `_C`: Clockstamp
* `_D`: Duration (us precision)
* Reserved Names (including suffixes as mentioned before):
* `Channel`
* `Sender`
* `SenderCycle`
* `Receiver`
* `ReceiverCycle`
* `EndToEnd`
* Note that expressions with other suffixes such as `SenderQueueing_T` would be allowed.
%% Cell type:markdown id: tags:
# X-Lap in Action
%% Cell type:markdown id: tags:
## Imports
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
from xlap.parse import evaluate, parse_config from xlap.parse import evaluate, parse_config
import xlap.analyse.jitter as jitter import xlap.analyse.jitter as jitter
from xlap.analyse.regress import linear as linear_regression from xlap.analyse.regress import linear as linear_regression
from xlap.analyse.trace import trace from xlap.analyse.trace import traces
from xlap.analyse.common import extract_durations from xlap.analyse.util import extract_durations
``` ```
%% Cell type:markdown id: tags:
## Data Retrieval
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
config = parse_config() config = parse_config()
data_files = config["data_files"] data_files = config["data_files"]
original = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=0) original = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=0)
``` ```
%% Cell type:markdown id: tags:
## Traces
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
trace(original.iloc[47],config) traces(original, config)
``` ```
%% Output %% Output
/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. /usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
warnings.warn("This figure includes Axes that are not " warnings.warn("This figure includes Axes that are not "
%% Cell type:markdown id: tags:
## Jitter Analysis
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
df = jitter.prep(original, config=config) df = jitter.prep(original, config=config)
jitter.trace_jitter(df) jitter.trace_jitter(df)
``` ```
%% Output %% Output
4018 / 4095 are no outliers. 4018 / 4095 are no outliers.
/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. /usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
warnings.warn("This figure includes Axes that are not " warnings.warn("This figure includes Axes that are not "
%% Cell type:code id: tags:
``` python
linear_regression(original,"Feedback_D")
```
%% Output
R-Score: 0.0444517602497
/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
warnings.warn("This figure includes Axes that are not "
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
......
...@@ -2,6 +2,8 @@ import numpy as np ...@@ -2,6 +2,8 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from xlap.analyse.util import extract_durations from xlap.analyse.util import extract_durations
from ipywidgets import interact