-
Notifications
You must be signed in to change notification settings - Fork 0
/
netperf.py
58 lines (43 loc) · 1.47 KB
/
netperf.py
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
import matplotlib.pyplot as plt
import pandas as pd
import re
from pathlib import Path
import numpy as np
from plot import *
# Function to parse Iozone output
def extract_number(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
for line in lines:
if re.match(r'^\d.*', line):
tmp = line.strip()
return float(tmp.split(' ')[-1])
if __name__ == "__main__":
values = []
names = []
workload = []
folder_path = Path("results")
for file_path in folder_path.rglob('*'): # Recursively search all files
if is_workload(file_path, "netperf"):
file_path = str(file_path)
df = extract_number(file_path)
name = file_path.split('/')[1]
names.append(name.split('_')[1])
values.append(df)
workload.append(name.split('_')[2].split('.')[0])
dico = {}
for i in range(len(values)):
if names[i] not in dico:
dico[names[i]] = []
dico[names[i]].append((values[i], workload[i]))
for key in dico.keys():
dico[key] = sorted(dico[key])
title = 'Netperf microbenchmark - throuput in [KB/s] - currently test running both machines on localhost'
names = []
values = []
for key in dico.keys():
names.append(key)
list1, list2 = zip(*dico[key])
values.append(list(list1))
indices = list(list2)
generate_plot(values, names, indices, title, "netperf")