Commit 3cc35d81 authored by Stefan Reif's avatar Stefan Reif

...

parent ccba7c21
......@@ -5,6 +5,13 @@ from scipy import stats
import matplotlib.pyplot as plt
import xlap.analyse.latency as latency
plt.rcParams['ps.useafm'] = True
plt.rcParams['pdf.use14corefonts'] = True
plt.rcParams['text.usetex'] = False
plt.rcParams['font.family'] = 'sans-serif'
#plt.rcParams['font.sans-serif'] = 'Latin Modern Sans'
#plt.rcParams['font.monospace'] = 'FreeMono'
# Taken from: http://composition.al/blog/2015/11/29/a-better-way-to-add-labels-to-bar-charts-with-matplotlib/
def autolabel(rects, ax, labels):
# Get y-axis height to calculate label position from.
......@@ -26,7 +33,7 @@ def autolabel(rects, ax, labels):
color = "white"
align = "right"
else:
label_position = width + (x_width * 0.01)
label_position = width + (x_width * 0.00)
mono = {'family': 'monospace'}
ax.text(label_position, rect.get_y(), labels[i], ha=align, va='bottom', rotation=0, color=color, fontdict=mono)
......@@ -41,7 +48,8 @@ def _plot_regions(dataset):
correlations = list(map(lambda x: x['Slowdown'], relevant))
ticks = list(map(lambda x: "<%s,%s>" % (x['Start'][:-2], x['End'][:-2]), relevant))
fig, ax = plt.subplots()
rects = ax.barh(x, correlations, align="center", tick_label="", color='#3babaf')
#rects = ax.barh(x, correlations, align="center", tick_label="", color='#3babaf')
rects = ax.barh(x, correlations, align="center", tick_label="")
autolabel(rects, ax, ticks)
plt.xlabel('Normalized slowdown')
......
......@@ -5,9 +5,15 @@ import numpy as np
import sys
import graphviz
class LatencyAnalysis():
def __init__(self, cfg=None, hdb=None):
plt.rcParams['ps.useafm'] = True
plt.rcParams['pdf.use14corefonts'] = True
plt.rcParams['text.usetex'] = False
plt.rcParams['font.family'] = 'sans-serif'
#plt.rcParams['font.sans-serif'] = 'Latin Modern Sans'
#plt.rcParams['font.monospace'] = 'FreeMono'
self.cfg = cfg
correlations = []
......@@ -152,13 +158,15 @@ def autolabel(rects, ax, labels):
# If we can fit the label above the column, do that;
# otherwise, put it inside the column.
if p_width > 0.50: # arbitrary; 95% looked good to me.
label_position = width - (x_width) + 0.7
#label_position = width - (x_width) + 0.7
label_position = width - (x_width * 0.01)
color = "white"
align = "right"
else:
label_position = width + (x_width * 0.01)
label_position = width + (x_width * 0.002)
ax.text(label_position, rect.get_y(), labels[i], ha=align, va='bottom', rotation=0, color=color)
mono = {'family': 'monospace'}
ax.text(label_position, rect.get_y(), labels[i], ha=align, va='bottom', rotation=0, color=color, fontdict=mono)
def _plot_critical_regions(hdb):
......@@ -169,11 +177,12 @@ def _plot_critical_regions(hdb):
x = np.arange(len(relevant))
correlations = list(map(lambda x: x['Correlation'], relevant))
ticks = list(map(lambda x: "%s-%s" % (x['Start'][:-2], x['End'][:-2]), relevant))
ticks = list(map(lambda x: "<%s,%s>" % (x['Start'][:-2], x['End'][:-2]), relevant))
fig, ax = plt.subplots()
rects = ax.barh(x, correlations, align="center", tick_label="")
autolabel(rects, ax, ticks)
plt.xlabel('Latency criticality')
plt.tight_layout()
plt.savefig("latency-criticality.pdf")
plt.close()
......
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