@@ -18,13 +18,17 @@ def print_log_dir_times(logdir, args):
1818 first = True
1919 totalElapsed = 0
2020 total_max_memory = 0
21- print (logdir )
21+ if not args .match :
22+ print (logdir )
2223
2324 # Loop on all log files in the directory
2425 for f in sorted (pathlib .Path (logdir ).glob ("**/*.log" )):
2526 if "eqy_output" in str (f ):
2627 continue
2728 # Extract Elapsed Time line from log file
29+ stem = os .path .splitext (os .path .basename (str (f )))[0 ]
30+ if args .match and args .match != stem :
31+ continue
2832 with open (str (f )) as logfile :
2933 found = False
3034 for line in logfile :
@@ -95,7 +99,7 @@ def print_log_dir_times(logdir, args):
9599 print (
96100 format_str
97101 % (
98- os . path . splitext ( os . path . basename ( str ( f )))[ 0 ] ,
102+ stem ,
99103 elapsedTime ,
100104 peak_memory ,
101105 odb_hash [0 :20 ],
@@ -104,14 +108,18 @@ def print_log_dir_times(logdir, args):
104108 totalElapsed += elapsedTime
105109 total_max_memory = max (total_max_memory , int (peak_memory ))
106110
107- if totalElapsed != 0 :
111+ if totalElapsed != 0 and not args . match :
108112 print (format_str % ("Total" , totalElapsed , total_max_memory , "" ))
109113
110114
111115def scan_logs (args ):
112116 parser = argparse .ArgumentParser (
113117 description = "Print elapsed time for every step in the flow"
114118 )
119+ parser .add_argument (
120+ "--match" ,
121+ help = "Match this string in the log file names" ,
122+ )
115123 parser .add_argument (
116124 "--logDir" , "-d" , required = True , nargs = "+" , help = "Log files directories"
117125 )
0 commit comments