Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X-Lap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
LARN
X-Lap
Commits
27d0f7e8
Commit
27d0f7e8
authored
Jun 24, 2019
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~= refactor
parent
e5fd2741
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
70 deletions
+56
-70
notebook.ipynb
notebook.ipynb
+29
-66
xlap/analyse/jitter.py
xlap/analyse/jitter.py
+7
-2
xlap/analyse/timing.py
xlap/analyse/timing.py
+16
-0
xlap/analyse/trace.py
xlap/analyse/trace.py
+1
-1
xlap/analyse/util.py
xlap/analyse/util.py
+3
-1
No files found.
notebook.ipynb
View file @
27d0f7e8
...
...
@@ -7,36 +7,13 @@
"# X-Lap in Action"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import logging\n",
"logger = logging.getLogger()\n",
"logger.setLevel(logging.DEBUG)\n",
"from ipywidgets import interact, interactive, fixed, interact_manual\n",
"import ipywidgets as widgets\n",
"from xlap.parse import evaluate, evaluate_side, parse_config\n",
"import xlap.analyse.jitter as jitter\n",
"from xlap.analyse.cdf import multi_cdf\n",
"from xlap.analyse.regress import linear as linear_regression\n",
"from xlap.analyse.trace import traces\n",
"from xlap.analyse.correlation import correlation, multi_correlation\n",
"from xlap.analyse.latency import analyse\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import copy\n",
"%matplotlib inline\n",
"colors = [\"#E69F00\", \"#009E73\", \"#56B4E9\", \"#CC79A7\", \"#D55E00\"]"
"%matplotlib inline"
]
},
{
...
...
@@ -52,18 +29,19 @@
"metadata": {},
"outputs": [],
"source": [
"from xlap.parse import evaluate, parse_config\n",
"config = parse_config()\n",
"data_files = {\n",
" \"sender\": \"rtn2018/20180417_testbed/\",\n",
" \"receiver\": \"rtn2018/20180417_testbed/\"\n",
"}\n",
"
original1
= evaluate(data_files[\"sender\"] + \"sender-1000000.csv\", data_files[\"receiver\"] + \"receiver-1000000.csv\", config=config, kind=0)\n",
"
original1
.name = \"1GHz\"\n",
"
original2
= evaluate(data_files[\"sender\"] + \"sender-2000000.csv\", data_files[\"receiver\"] + \"receiver-2000000.csv\", config=config, kind=0)\n",
"
original2
.name = \"2GHz\"\n",
"
original3
= evaluate(data_files[\"sender\"] + \"sender-3000000.csv\", data_files[\"receiver\"] + \"receiver-3000000.csv\", config=config, kind=0)\n",
"
original3
.name = \"3GHz\"\n",
"dfs = [
original1, original2, original3
]"
"
df_1GHz
= evaluate(data_files[\"sender\"] + \"sender-1000000.csv\", data_files[\"receiver\"] + \"receiver-1000000.csv\", config=config, kind=0)\n",
"
df_1GHz
.name = \"1GHz\"\n",
"
df_2GHz
= evaluate(data_files[\"sender\"] + \"sender-2000000.csv\", data_files[\"receiver\"] + \"receiver-2000000.csv\", config=config, kind=0)\n",
"
df_2GHz
.name = \"2GHz\"\n",
"
df_3GHz
= evaluate(data_files[\"sender\"] + \"sender-3000000.csv\", data_files[\"receiver\"] + \"receiver-3000000.csv\", config=config, kind=0)\n",
"
df_3GHz
.name = \"3GHz\"\n",
"dfs = [
df_1GHz, df_2GHz, df_3GHz
]"
]
},
{
...
...
@@ -79,7 +57,8 @@
"metadata": {},
"outputs": [],
"source": [
"traces(original1, config, global_xaxis=True)"
"from xlap.analyse.trace import traces\n",
"traces(df_1GHz, config, global_xaxis=True)"
]
},
{
...
...
@@ -95,11 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"def multi_trace_jitter(dfs, config):\n",
" for df in dfs:\n",
" print(\"############################ {} ############################\".format(df.name))\n",
" jitter.trace_jitter(df, config=config, threshold=200)\n",
" \n",
"from xlap.analyse.jitter import multi_trace_jitter\n",
"multi_trace_jitter(dfs, config)"
]
},
...
...
@@ -116,14 +91,17 @@
"metadata": {},
"outputs": [],
"source": [
"from xlap.analyse.cdf import multi_cdf\n",
"from xlap.analyse.util import colors\n",
"import copy\n",
"cfg = copy.deepcopy(config)\n",
"
d = cfg[\"durations\"]
\n",
"\n",
"
l=(\"Decoding\",\"ReceiverIPC\",\"HandlePacket\", \"Feedback\", \"SenderIPC\",\"SenderEnqueued\",\"Enqueue\")
\n",
"
for e in l:
\n",
"
if e in l:
\n",
"
del d[e]
\n",
"\n",
"
list(map(cfg[\"durations\"].pop, (\"Decoding\",
\n",
"
\"ReceiverIPC\",
\n",
"
\"HandlePacket\",
\n",
"
\"Feedback\",
\n",
"
\"SenderIPC\",
\n",
"
\"SenderEnqueued\",
\n",
"
\"Enqueue\")))
\n",
"multi_cdf(dfs, cfg, colors=colors)"
]
},
...
...
@@ -140,6 +118,7 @@
"metadata": {},
"outputs": [],
"source": [
"from xlap.analyse.correlation import multi_correlation\n",
"multi_correlation(dfs, config, colors=colors, figsize=(3.0,2.0), cols=4)"
]
},
...
...
@@ -156,7 +135,8 @@
"metadata": {},
"outputs": [],
"source": [
"d = analyse(original1, config)"
"from xlap.analyse.latency import analyse\n",
"d = analyse(df_1GHz, config)"
]
},
{
...
...
@@ -204,25 +184,8 @@
"metadata": {},
"outputs": [],
"source": [
"from scipy import stats\n",
"from xlap.analyse.util import extract_durations\n",
"import numpy as np\n",
"\n",
"def timing_behaviour(df1, df2, config, confidence=0.9):\n",
" durations = [x + \"_D\" for x in extract_durations(config)]\n",
" \n",
" norm = lambda x: x / np.max(x)\n",
" \n",
" for duration in durations:\n",
" rvs1 = norm(df1[duration])\n",
" rvs2 = norm(df2[duration])\n",
" stat, pvalue = stats.ks_2samp(rvs1, rvs2)\n",
" result = \"CANNOT REJECT\"\n",
" if pvalue < 1 - confidence:\n",
" result = \"REJECT\"\n",
" print(duration.ljust(20), \"{:.6f}\".format(pvalue), result, sep=\"\\t\\t\")\n",
"\n",
"timing_behaviour(original1, original2, config)"
"from xlap.analyse.timing import timing_behaviour\n",
"timing_behaviour(df_1GHz, df_2GHz, config)"
]
},
{
...
...
@@ -231,7 +194,7 @@
"metadata": {},
"outputs": [],
"source": [
"timing_behaviour(
original1, original3
, config)"
"timing_behaviour(
df_1GHz, df_3GHz
, config)"
]
},
{
...
...
@@ -240,7 +203,7 @@
"metadata": {},
"outputs": [],
"source": [
"timing_behaviour(
original2, original3
, config)"
"timing_behaviour(
df_2GHz, df_3GHz
, config)"
]
}
],
...
...
xlap/analyse/jitter.py
View file @
27d0f7e8
...
...
@@ -38,10 +38,15 @@ def trace_jitter(data_frame, config=None, threshold=None, export=False, file_nam
if
threshold
is
None
:
threshold
=
get_outlier_threshold
(
data_frame
[
"EndToEnd_D"
].
describe
())
df_no_outliers
=
data_frame
[
data_frame
[
"EndToEnd_D"
]
<=
threshold
]
fig
=
plt
.
gcf
(
)
ax
,
fig
=
box
(
df_no_outliers
,
(
0
,
threshold
),
export
,
file_name
,
figsize
)
fig
.
set_size_inches
(
figsize
[
0
],
figsize
[
1
])
box
(
df_no_outliers
,
(
0
,
threshold
),
export
,
file_name
,
figsize
)
print
(
"{} / {} are no outliers."
.
format
(
len
(
df_no_outliers
),
len
(
data_frame
)))
fig
.
canvas
.
set_window_title
(
'Jitter Analysis'
)
plt
.
show
()
plt
.
close
()
return
None
def
multi_trace_jitter
(
dfs
,
config
):
for
df
in
dfs
:
print
(
"############################ {} ############################"
.
format
(
df
.
name
))
trace_jitter
(
df
,
config
=
config
,
threshold
=
200
)
xlap/analyse/timing.py
0 → 100644
View file @
27d0f7e8
from
scipy
import
stats
from
xlap.analyse.util
import
extract_durations
import
numpy
as
np
def
timing_behaviour
(
df1
,
df2
,
config
,
confidence
=
0.9
):
durations
=
[
x
+
"_D"
for
x
in
extract_durations
(
config
)]
norm
=
lambda
x
:
x
/
np
.
max
(
x
)
for
duration
in
durations
:
rvs1
=
norm
(
df1
[
duration
])
rvs2
=
norm
(
df2
[
duration
])
stat
,
pvalue
=
stats
.
ks_2samp
(
rvs1
,
rvs2
)
result
=
(
"REJECT"
if
pvalue
<
1
-
confidence
else
"CANNOT REJECT"
)
print
(
duration
.
ljust
(
20
),
"{:.6f}"
.
format
(
pvalue
),
result
,
sep
=
"
\t\t
"
)
xlap/analyse/trace.py
View file @
27d0f7e8
...
...
@@ -92,6 +92,6 @@ def traces(df, config, figsize=(10, 4.5), global_xaxis=False):
if
global_xaxis
:
t_max
=
df
[
"EndToEnd_D"
].
max
()
@
interact
(
seq_no
=
widgets
.
IntSlider
(
min
=
1
,
max
=
len
(
df
),
step
=
1
,
value
=
47
))
@
interact
(
seq_no
=
widgets
.
IntSlider
(
min
=
1
,
max
=
len
(
df
),
step
=
1
,
value
=
47
,
description
=
"Seq. No."
))
def
_f
(
seq_no
):
trace
(
df
.
iloc
[
seq_no
],
config
,
figsize
=
figsize
,
t_max
=
t_max
)
xlap/analyse/util.py
View file @
27d0f7e8
...
...
@@ -2,6 +2,8 @@ import matplotlib.pyplot as plt
import
numpy
as
np
import
math
colors
=
[
"#E69F00"
,
"#009E73"
,
"#56B4E9"
,
"#CC79A7"
,
"#D55E00"
]
def
cdf
(
values
,
ax
=
None
,
grid
=
False
,
**
kwargs
):
if
ax
is
None
:
ax
=
plt
...
...
@@ -54,7 +56,7 @@ def box(data_frame, xlim=None, export=False, file_name=None, figsize=(8, 4.5)):
plt
.
tight_layout
()
if
export
and
file_name
is
not
None
:
fig
.
savefig
(
file_name
)
return
ax
,
fig
def
describe_table
(
df
):
stats
=
df
.
describe
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment