Skip to content

Commit

Permalink
makefile: elapsed time python code fewer red lines in editor
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Apr 16, 2024
1 parent a008f1c commit afccf3f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions flow/util/genElapsedTime.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
parser.print_help()
sys.exit(1)


def print_log_dir_times(logdir):
first = True
totalElapsed = 0
Expand Down Expand Up @@ -55,24 +56,28 @@ def print_log_dir_times(logdir):
elapsedTime = int(timeList[0])*60 + int(timeList[1])
elif len(timeList) == 3:
# Hours, minutes, and seconds are present
elapsedTime = int(timeList[0])*3600 + int(timeList[1])*60 + int(timeList[2])
elapsedTime = (int(timeList[0])*3600 +
int(timeList[1])*60 + int(timeList[2]))
else:
print('Elapsed time not understood in', str(line), file=sys.stderr)
print('Elapsed time not understood in',
str(line), file=sys.stderr)

if not found:
print('No elapsed time found in', str(f), file=sys.stderr)
print('No elapsed time found in', str(f), file=sys.stderr)
continue

# Print the name of the step and the corresponding elapsed time
if elapsedTime != 0:
if first and not args.noHeader:
print("%-25s %10s" % ("Log", "Elapsed seconds"))
first = False
print('%-25s %10s' % (os.path.splitext(os.path.basename(str(f)))[0], elapsedTime))
print('%-25s %10s' % (os.path.splitext(
os.path.basename(str(f)))[0], elapsedTime))
totalElapsed += elapsedTime

if totalElapsed != 0:
print("%-25s %10s" % ( "Total", totalElapsed ))
print("%-25s %10s" % ("Total", totalElapsed))


for log_dir in args.logDir:
print_log_dir_times(log_dir)

0 comments on commit afccf3f

Please sign in to comment.