command line argument

This commit is contained in:
Jelena Dokic 2020-02-22 13:18:18 +01:00
parent d5ad63e541
commit 2d4d951447
1 changed files with 12 additions and 11 deletions

23
show.py
View File

@ -1,3 +1,4 @@
import sys
from os import listdir
import numpy as np
@ -14,21 +15,21 @@ recv = []
page_fault = []
filenames = []
for filename in listdir('output'):
for filename in sorted(listdir(sys.argv[1])):
filenames.append(filename)
with open('output/' + filename) as f:
with open(sys.argv[1] + '/' + filename) as f:
content = f.readlines()
new_dict = dict()
for line in content[1:]:
new_dict[line.split(',')[0]] = int(line.split(',')[2])
thread.append(new_dict['thread'])
fork.append(new_dict['fork'])
read.append(new_dict['read'])
write.append(new_dict['write'])
mmap_munmap.append(new_dict['mmap_munmap'])
send.append(new_dict['send'])
recv.append(new_dict['recv'])
page_fault.append(new_dict['page_fault'])
thread.append(int(new_dict['thread'] / 1000))
fork.append(int(new_dict['fork'] / 1000))
read.append(int(new_dict['read'] / 1000))
write.append(int(new_dict['write'] / 1000))
mmap_munmap.append(int(new_dict['mmap_munmap'] / 1000))
send.append(int(new_dict['send'] / 1000))
recv.append(int(new_dict['recv'] / 1000))
page_fault.append(int(new_dict['page_fault'] / 1000))
headerColor = 'grey'
@ -37,7 +38,7 @@ rowOddColor = 'white'
colors = [
'rgb(0, 255, 0)', 'rgb(225, 255, 77)', 'rgb(212, 255, 77)',
'rgb(255, 255, 51)', 'rgb(255, 255, 0)', 'rgb(212, 255, 0)',
'rgb(212, 255, 0)', 'rgb(255, 255, 0)', 'rgb(255, 255, 51)',
'rgb(255, 221, 51)', 'rgb(255, 102, 25)', 'rgb(255, 42, 0)'
]