File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,15 @@ def format_human_readable_memory(num_kbytes):
422
422
return value
423
423
424
424
425
+ def get_memory_usage (logfile ):
426
+ """Extrats the memory usage from the *.out log files"""
427
+ with open (logfile , "r" ) as fpmem :
428
+ for line in fpmem .readlines ():
429
+ if "Maximum resident set size" in line :
430
+ return format_human_readable_memory (int (line .split ()[- 1 ]))
431
+ return "--"
432
+
433
+
425
434
# pylint: enable=too-many-statements
426
435
427
436
@@ -499,13 +508,12 @@ def vtr_command_main(arg_list, prog=None):
499
508
500
509
finally :
501
510
seconds = datetime .now () - start
502
- with open (temp_dir / "vpr.out" , "r" ) as fpmem :
503
- for line in fpmem .readlines ():
504
- if "Maximum resident set size" in line :
505
- mem_usage = format_human_readable_memory (int (line .split ()[- 1 ]))
511
+
506
512
print (
507
513
"{status} (took {time}, vpr run consumed {max_mem} memory)" .format (
508
- status = error_status , time = vtr .format_elapsed_time (seconds ), max_mem = mem_usage
514
+ status = error_status ,
515
+ time = vtr .format_elapsed_time (seconds ),
516
+ max_mem = get_memory_usage (temp_dir / "vpr.out" ),
509
517
)
510
518
)
511
519
temp_dir .mkdir (parents = True , exist_ok = True )
You can’t perform that action at this time.
0 commit comments