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
b6c6d92d
Commit
b6c6d92d
authored
Feb 13, 2018
by
Andreas Schmidt
Browse files
Further speedup by making cycle stamp access faster.
parent
889213f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
xlap/analyse/latency.py
View file @
b6c6d92d
...
...
@@ -4,20 +4,11 @@ from xlap.analyse.util import get_outlier_threshold, extract_durations, box
from
scipy.stats.stats
import
pearsonr
import
sys
def
_get_cyclestamp
(
df
,
event
,
idx
):
"""
get the cyclestamp related to an *_T event
"""
# TODO: this function is probably terribly slow
cname
=
str
(
event
)[:
-
2
]
+
"_C"
cycleevent
=
[
x
for
x
in
list
(
df
)
if
str
(
x
)
==
cname
][
0
]
return
df
[
cycleevent
].
iloc
[
idx
]
def
_get_thread_for_event
(
config
,
e
):
name
=
str
(
e
)[:
-
2
]
try
:
question
=
config
[
"stamps"
][
name
][
"Thread"
]
return
question
return
config
[
"stamps"
][
name
][
"Thread"
]
except
KeyError
:
print
(
"Cannot find %s"
.
format
(
name
),
file
=
sys
.
stderr
)
return
None
...
...
@@ -31,14 +22,16 @@ def _happens_before(df, a, b, config):
# concurrent.
ta
=
_get_thread_for_event
(
config
,
a
)
tb
=
_get_thread_for_event
(
config
,
b
)
cname_a
=
str
(
a
)[:
-
2
]
+
"_C"
cname_b
=
str
(
b
)[:
-
2
]
+
"_C"
if
(
ta
==
tb
and
ta
!=
None
and
tb
!=
None
):
for
i
in
range
(
l
):
tsa
=
df
[
a
].
iloc
[
i
]
tsb
=
df
[
b
].
iloc
[
i
]
if
tsa
>
tsb
:
return
False
csa
=
_get_cyclestamp
(
df
,
a
,
i
)
csb
=
_get_cyclestamp
(
df
,
b
,
i
)
csa
=
df
[
cname_a
].
iloc
[
i
]
csb
=
df
[
cname_b
].
iloc
[
i
]
if
tsa
==
tsb
and
csa
>
csb
and
csb
!=
0
:
return
False
return
True
...
...
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