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
f47333ab
Commit
f47333ab
authored
Feb 13, 2018
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed-up happens before by using pandas logical operations.
parent
b6c6d92d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
15 deletions
+6
-15
xlap/analyse/latency.py
xlap/analyse/latency.py
+6
-15
No files found.
xlap/analyse/latency.py
View file @
f47333ab
...
...
@@ -17,7 +17,6 @@ def _happens_before(df, a, b, config):
"""
check if a happens-before b in the trace
"""
l
=
len
(
df
[
a
])
# check whether a and b occur in the same thread. If so, a and b cannot be
# concurrent.
ta
=
_get_thread_for_event
(
config
,
a
)
...
...
@@ -25,23 +24,15 @@ def _happens_before(df, a, b, config):
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
=
df
[
cname_a
].
iloc
[
i
]
csb
=
df
[
cname_b
].
iloc
[
i
]
if
tsa
==
tsb
and
csa
>
csb
and
csb
!=
0
:
return
False
return
True
tg
=
df
[
a
]
>
df
[
b
]
if
tg
.
any
():
return
False
df2
=
df
[
df
[
a
]
==
df
[
b
]]
return
not
((
df2
[
cname_a
]
>
df2
[
cname_b
])
&
df2
[
cname_b
]
!=
0
).
any
()
# since a and b occur in different threads, we cannot compare cyclestamps.
# If in doubt, a and b are concurrent.
for
i
in
range
(
l
):
if
df
[
a
].
iloc
[
i
]
>=
df
[
b
].
iloc
[
i
]:
return
False
return
True
return
not
(
df
[
a
]
>=
df
[
b
]).
any
()
def
_fast_happens_before
(
df
,
a
,
b
,
hb
):
"""
...
...
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