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