Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
X-Lap
Commits
1088251d
Commit
1088251d
authored
Feb 13, 2018
by
Stefan Reif
Browse files
Plot latency criticality
Create a plot file that visualises the latency criticality of code regions.
parent
f47333ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
xlap/analyse/latency.py
View file @
1088251d
...
...
@@ -2,6 +2,7 @@ import pandas as pd
import
matplotlib.pyplot
as
plt
from
xlap.analyse.util
import
get_outlier_threshold
,
extract_durations
,
box
from
scipy.stats.stats
import
pearsonr
import
numpy
as
np
import
sys
...
...
@@ -119,10 +120,20 @@ def _plot_critical_regions(df,hdb):
"""
plot regions, sorted by latency criticality
"""
# TODO: actually plot the data
for
region
in
sorted
(
hdb
,
key
=
lambda
x
:
-
x
[
'Correlation'
]):
print
(
"%-10f %10s -> %10s"
%
(
region
[
'Correlation'
],
region
[
'Start'
],
region
[
'End'
]),
file
=
sys
.
stderr
)
relevant
=
sorted
([
x
for
x
in
hdb
if
x
[
'Correlation'
]
>
0
],
key
=
lambda
x
:
-
x
[
'Correlation'
])
x
=
np
.
arange
(
len
(
relevant
))
bars
=
plt
.
bar
(
x
,
list
(
map
(
lambda
x
:
x
[
'Correlation'
],
relevant
)))
# TODO: find a more elegant solution for the label text
plt
.
xticks
(
x
,
list
(
map
(
lambda
x
:
"%s-%s"
%
(
x
[
'Start'
][:
-
2
],
x
[
'End'
][:
-
2
])
,
relevant
)),
rotation
=
90
)
plt
.
tight_layout
()
plt
.
savefig
(
"latency-criticality.png"
)
plt
.
close
()
def
analyse
(
df
,
config
):
hb
=
[]
...
...
Write
Preview
Supports
Markdown
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