-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathload_trace.py
26 lines (21 loc) · 793 Bytes
/
load_trace.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
import os
COOKED_TRACE_FOLDER = './cooked_traces/'
def load_trace(cooked_trace_folder=COOKED_TRACE_FOLDER):
cooked_files = os.listdir(cooked_trace_folder)
all_cooked_time = []
all_cooked_bw = []
all_file_names = []
for cooked_file in cooked_files:
file_path = cooked_trace_folder + cooked_file
cooked_time = []
cooked_bw = []
# print file_path
with open(file_path, 'rb') as f:
for line in f:
parse = line.split()
cooked_time.append(float(parse[0]))
cooked_bw.append(float(parse[1]))
all_cooked_time.append(cooked_time)
all_cooked_bw.append(cooked_bw)
all_file_names.append(cooked_file)
return all_cooked_time, all_cooked_bw, all_file_names