Commit 450bb8e7 authored by Stefan Reif's avatar Stefan Reif

Add _locally_happens_directly_before analysis

This function is similar to _happens_directly_before, but it should
work better for intra-thread durations.
parent fe66a265
......@@ -73,6 +73,52 @@ def _happens_directly_before(df, a, b, hb):
return False
return True
def _locally_happens_directly_before(df, a, b, hb, config):
"""
check if a happens-directly-before b in the trace but, be a little bit more
tolerant regarding intra-thread durations. Consider the following scenario
Thread A: A1 -> A2 -> A3
Thread B: B1 -> B2
This setup can result in the following directly-happens-before graph:
A1 B1
\ /
A2
/ \
A3 B2
In this case, B1 does not happens-directly-before B2 because, by chance, A2
happens inbetween. If we ignore this anomaly, we only analyse <B1,A2> and
<A2,B2>. Both ranges probably have low latency criticality, since their
durations are random (because they depend on thread interleavings).
However, we really want to analyse <B1,B2> because they actually represent
a meaningful range in thread B.
This function therefore computes a modified happens-directly-before graph
with relaxed restrictions for intra-thread ranges:
A1 B1
\ /|
A2 |
/ \|
A3 B2
"""
if not _fast_happens_before(df, a, b, hb):
return False
ta = _get_thread_for_event(config, a)
tb = _get_thread_for_event(config, b)
if ta == tb and ta != None and tb != None:
for c in df:
if _get_thread_for_event(config, c) != ta:
continue
if _fast_happens_before(df, a, c, hb) and _fast_happens_before(df, c, b, hb):
return False
return True
else:
return _happens_directly_before(df, a, b, hb)
def _plot_controlflow_graph(df, hdb):
"""
print the control flow graph in a format that dot understands
......@@ -121,6 +167,7 @@ def analyse(df, config):
continue
if str(event1) == str(event2):
continue
#if _locally_happens_directly_before(df, event1, event2, hb, config):
if _happens_directly_before(df, event1, event2, hb):
# compute the correlation between e2e latency and event1-event2 latency
l1 = list(df[event1])
......
Markdown is supported
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