-
Notifications
You must be signed in to change notification settings - Fork 2
/
load_trace.py
32 lines (27 loc) · 1.01 KB
/
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
27
28
29
30
31
32
import os
# COOKED_TRACE_FOLDER = './test/'
# COOKED_TRACE_FOLDER = './traces_belgium/'
COOKED_TRACE_FOLDER = './cooked_traces/'
# COOKED_TRACE_FOLDER = './traces_fcc/'
# COOKED_TRACE_FOLDER = './unfair/user1/'
# COOKED_TRACE_FOLDER = './fair/user11/'
# COOKED_TRACE_FOLDER = './traces_oboe/'
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