Commit 1088251d authored by Stefan Reif's avatar Stefan Reif

Plot latency criticality

Create a plot file that visualises the latency criticality of code
regions.
parent f47333ab
......@@ -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 = []
......
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