Closed goldmanm closed 7 years ago
It might be helpful to run this script automatically at the end of all the simulations), so it could be automatically placed in the log file. Thoughts?
I like this! I would like to reorder the columns though:
data = pd.DataFrame(columns=['example', 'time benchmark', 'time new', 'memory benchmark', 'memory new'])
with open('main_log.out') as f:
next_line_contains_data = [False] * 5
for line in f.readlines():
if 'Running' in line:
current_example = line.split()[1]
elif any(next_line_contains_data):
if any(next_line_contains_data[-2:]): # indicates memory
data_in_line = -2
else:
data_in_line = -1
data.loc[current_example,data.columns[next_line_contains_data]] = line.split()[data_in_line]
next_line_contains_data = [False] * 5
elif 'Execution time, Benchmark:' in line:
next_line_contains_data[1] = True
elif 'Execution time, Tested:' in line:
next_line_contains_data[2] = True
elif 'Memory used, Benchmark:' in line:
next_line_contains_data[3] = True
elif 'Memory used, Tested:' in line:
next_line_contains_data[4] = True
Result:
example | time benchmark | time new | memory benchmark | memory new |
---|---|---|---|---|
eg1 | 00:00:03:08 | 00:00:01:36 | 449.96 | 468.78 |
eg3 | 00:00:12:13 | 00:00:01:51 | 399.68 | 399.90 |
eg5 | 00:00:01:44 | 00:00:01:04 | 357.26 | 351.57 |
eg6 | 00:00:00:52 | 00:00:00:48 | 344.66 | 345.05 |
@goldmanm thanks! I'll incorporate it into RMG-tests.
a new PR #54 includes this change has been made.
markdown script reads the logfile and prints an table of time and memory usage for input into github.