import numpy as np
from matplotlib import pyplot as plt

labels = ['loop overhead',
          'function call',
          'stack switching',
          'setjmp + stack switching',
          'fcontext switch, return',
          'fcontext create, switch, return',
          'pseudo callcc',
          'custom'
          ]

call_color = (0.3, 0.1, 0.4, 0.6)
setjmp_color = (0.3, 0.3, 0.4, 0.6)
fcontext_color = (0.3, 0.6, 0.4, 0.6)
custom_color = (0.3, 1.0, 0.4, 0.6)
colors = [
    call_color,
    call_color,
    setjmp_color,
    setjmp_color,
    fcontext_color,
    fcontext_color,
    fcontext_color,
    custom_color
]

dataX86 = np.array([
    0.55,
    2.79,
    5.60,
    14.93,
    9.51,
    11.00,
    18.66,
    7.86,
])
dataARM32 = np.array([  # TODO: Run and fill in data...damn that laptop crash
    1.26,
    4.97,
    11.25,
    54.50,
    51.93,
    57.45,
    101.29,
    23.74,
])
data = dataARM32

assert (len(labels) == len(data), "Must fill in all data!")
xAxis = np.array(range(0, len(labels)))

plt.bar(xAxis, data, color=colors)
plt.xticks(xAxis, labels, rotation=90)
plt.ylabel('runtime in ns')
plt.subplots_adjust(bottom=0.5, top=0.98)

plt.show()
