In [40]:
%matplotlib inline
import numpy as np
import re
import matplotlib.pyplot as plt
def memory_function(infile, dataset):
with open(infile, 'r') as mem:
lines = mem.readlines()
testar = np.asarray([line.strip() for line in lines]).astype(float)/1000
fig=plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(0, testar.shape[0]), testar - min(testar))
ax.set_ylabel('memory usage in GB')
ax.set_xlabel('Time (s)')
ax.set_title(dataset + ' single subject Memory Usage; max = %.2f GB; mean = %.2f GB' % (max(testar), np.mean(testar)))
return fig
def cpu_function(infile, dataset):
with open(infile, 'r') as mem:
lines = mem.readlines()
testar = np.asarray([line.strip() for line in lines]).astype(float)
fig=plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(0, testar.shape[0]), testar)
ax.set_ylabel('CPU usage (%)')
ax.set_xlabel('Time (s)')
ax.set_title(dataset + ' single subject Processor Usage; max = %.1f per; mean = %.1f per' % (max(testar), np.mean(testar)))
return fig
def disk_function(infile, dataset):
with open(infile, 'r') as mem:
lines = mem.readlines()
testar = np.asarray([line.strip() for line in lines]).astype(float)/1000000
fig=plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(0, testar.shape[0]), testar - min(testar))
ax.set_ylabel('Disk usage GB')
ax.set_xlabel('Time (s)')
ax.set_title(dataset + ' single subject Disk Usage; max = %.1f GB; mean = %.1f GB' % (max(testar), np.mean(testar)))
return fig
memfig = memory_function('BNU_sub/output_single/membnu_single.txt', 'BNU 1')
diskfig = disk_function('HNU_sub/output_single/diskhnu_single.txt', 'BNU 1')
cpufig = cpu_function('BNU_sub/output_single/cpubnu_single.txt', 'BNU 1')
memfig.show()
diskfig.show()
cpufig.show()
In [39]:
memfig = memory_function('HNU_sub/output_single/memhnu_single.txt', 'HNU 1')
diskfig = disk_function('HNU_sub/output_single/diskhnu_single.txt', 'HNU 1')
cpufig = cpu_function('HNU_sub/output_single/cpuhnu_single.txt', 'HNU 1')
memfig.show()
diskfig.show()
cpufig.show()
In [38]:
memfig = memory_function('DC_sub/output_single/memsingle.txt', 'DC 1')
diskfig = disk_function('DC_sub/output_single/disksingle.txt', 'DC 1')
cpufig = cpu_function('DC_sub/output_single/cpusingle.txt', 'DC 1')
memfig.show()
diskfig.show()
cpufig.show()
In [ ]:
In [ ]: