In [52]:
import matplotlib.pyplot as plt
%matplotlib inline
In [53]:
# Read captured data
def read_stats(filename):
    time = []
    vmsize = []
    vmpeak = []
    vmrss = []
    vmhwm = []
    lists = (time, vmsize, vmpeak, vmrss, vmhwm)
    with open(filename, 'r') as f:
        for line in f:
            for (l, d) in zip(lists, line.split()):
                l.append(float(d))
    return lists
In [54]:
def plot_memstats(filename, title):
    (time, vmsize, vmpeak, vmrss, vmhwm) = read_stats(filename)
    
    plt.subplot(2,1,1)
    plt.plot(time, vmrss)
    plt.ylabel('Memory commit (KiB)')
    plt.title(title)

    plt.subplot(2,1,2)
    plt.plot(time, list(map(lambda k: k / 1024, vmsize)))
    plt.ylabel('VM size (MiB)')
    plt.xlabel('Time (sec)')


    plt.show()
In [57]:
plot_memstats('rkos-stats', 'RKOS memory usage')
In [56]:
plot_memstats('rust-stats', 'Hosted memory usage')
In [ ]: