2 def parse_time(log_file
):
4 for line
in open(log_file
):
6 _
, time
= [x
.strip() for x
in line
.split(":")]
7 time
, unit
= time
.split()
10 raise Exception(log_file
)
12 def parse_mem(log_file
):
14 for line
in open(log_file
):
15 if "Max Memory" in line
:
16 _
, mem
= [x
.strip() for x
in line
.split(":")]
17 mem
, unit
= mem
.split()
21 raise Exception(log_file
)
23 def parse_prog(log_file
):
25 p
= op
.basename(log_file
)
26 if p
.startswith('trim-'):
28 return p
.split("-")[0]
30 def parse_sim_real(log_file
):
32 p
= op
.basename(log_file
)
33 if p
.startswith('trim-'):
35 return p
.split("-")[1].split(".")[0]
37 def parse_trim(log_file
):
38 return ["no", "yes"][int("trim" in log_file
)]
41 FMT
= "{trimmed} & {program} & {time}(min) & {mem}(GB) & {dataset} \\\\"
45 print fmt
.replace("{", "").replace("}", "")
46 fmt
= re
.sub("\(.+?\)", "", fmt
)
48 trimmed
= parse_trim(log
)
49 mem
= '%.2f' % (parse_mem(log
) / 1000.)
50 time
= '%.2f' % (parse_time(log
) / 60.)
51 program
= parse_prog(log
)
52 dataset
= parse_sim_real(log
)
53 print fmt
.format(**locals())
55 if __name__
== "__main__":