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

Current notebook.

parent a42b07f4
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# X-Lap in Action # X-Lap in Action
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Imports ## Imports
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import logging import logging
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
from ipywidgets import interact, interactive, fixed, interact_manual from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets import ipywidgets as widgets
from xlap.parse import evaluate, evaluate_side, parse_config from xlap.parse import evaluate, evaluate_side, parse_config
import xlap.analyse.jitter as jitter import xlap.analyse.jitter as jitter
from xlap.analyse.cdf import multi_cdf from xlap.analyse.cdf import multi_cdf
from xlap.analyse.regress import linear as linear_regression from xlap.analyse.regress import linear as linear_regression
from xlap.analyse.trace import traces from xlap.analyse.trace import traces
from xlap.analyse.correlation import correlation, multi_correlation from xlap.analyse.correlation import correlation, multi_correlation
from xlap.analyse.latency import analyse from xlap.analyse.latency import analyse
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pandas as pd import pandas as pd
%matplotlib inline %matplotlib inline
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Data Retrieval ## Data Retrieval
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
config = parse_config() config = parse_config()
data_files = { data_files = {
"sender": "~/Work/Publications/rtn-2018/eval/20180417_testbed/", "sender": "~/Work/Publications/rtn-2018/eval/20180417_testbed/",
"receiver": "~/Work/Publications/rtn-2018/eval/20180417_testbed/" "receiver": "~/Work/Publications/rtn-2018/eval/20180417_testbed/"
} }
original1 = evaluate(data_files["sender"] + "sender-1000000.csv", data_files["receiver"] + "receiver-1000000.csv", config=config, kind=0) original1 = evaluate(data_files["sender"] + "sender-1000000.csv", data_files["receiver"] + "receiver-1000000.csv", config=config, kind=0)
original1.name = "1GHz" original1.name = "1GHz"
original2 = evaluate(data_files["sender"] + "sender-2000000.csv", data_files["receiver"] + "receiver-2000000.csv", config=config, kind=0) original2 = evaluate(data_files["sender"] + "sender-2000000.csv", data_files["receiver"] + "receiver-2000000.csv", config=config, kind=0)
original2.name = "2GHz" original2.name = "2GHz"
original3 = evaluate(data_files["sender"] + "sender-3000000.csv", data_files["receiver"] + "receiver-3000000.csv", config=config, kind=0) original3 = evaluate(data_files["sender"] + "sender-3000000.csv", data_files["receiver"] + "receiver-3000000.csv", config=config, kind=0)
original3.name = "3GHz" original3.name = "3GHz"
dfs = [original1, original2, original3] dfs = [original1, original2, original3]
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Traces ## Traces
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
traces(original1, config) traces(original1, config)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Jitter Analysis ## Jitter Analysis
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
def multi_trace_jitter(dfs, config): def multi_trace_jitter(dfs, config):
for df in dfs: for df in dfs:
print("############################ {} ############################".format(df.name)) print("############################ {} ############################".format(df.name))
jitter.trace_jitter(df, config=config, threshold=300) jitter.trace_jitter(df, config=config, threshold=200)
multi_trace_jitter(dfs, config) multi_trace_jitter(dfs, config)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## CDFs ## CDFs
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
multi_cdf(dfs, config, export=True) multi_cdf(dfs, config, export=True)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Correlation ## Correlation
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
multi_correlation(dfs, config, export=True) multi_correlation(dfs, config, export=True)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Latency Criticality ## Latency Criticality
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
d = analyse(original1, config) d = analyse(original1, config)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Correlations ### Correlations
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
d.corr.sort_values(ascending=False) d.corr.sort_values(ascending=False)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Control Flow Graph ### Control Flow Graph
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
d.cfg d.cfg
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Kolmogorov # Kolmogorov
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from scipy import stats from scipy import stats
from xlap.analyse.util import extract_durations from xlap.analyse.util import extract_durations
import numpy as np import numpy as np
def timing_behaviour(df1, df2, config, confidence=0.9): def timing_behaviour(df1, df2, config, confidence=0.9):
durations = [x + "_D" for x in extract_durations(config)] durations = [x + "_D" for x in extract_durations(config)]
norm = lambda x: x / np.max(x) norm = lambda x: x / np.max(x)
for duration in durations: for duration in durations:
rvs1 = norm(df1[duration]) rvs1 = norm(df1[duration])
rvs2 = norm(df2[duration]) rvs2 = norm(df2[duration])
stat, pvalue = stats.ks_2samp(rvs1, rvs2) stat, pvalue = stats.ks_2samp(rvs1, rvs2)
result = "CANNOT REJECT" result = "CANNOT REJECT"
if pvalue < 1 - confidence: if pvalue < 1 - confidence:
result = "REJECT" result = "REJECT"
print(duration.ljust(20), "{:.6f}".format(pvalue), result, sep="\t\t") print(duration.ljust(20), "{:.6f}".format(pvalue), result, sep="\t\t")
timing_behaviour(original1, original2, config) timing_behaviour(original1, original2, config)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
timing_behaviour(original1, original3, config) timing_behaviour(original1, original3, config)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
timing_behaviour(original2, original3, config) timing_behaviour(original2, original3, config)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment