plot.py 1.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
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()