Skip to content

Commit 0ae5fce

Browse files
authored
Merge pull request #3299 from Pinata-Consulting/log-hashes-per-step
Log hashes per step
2 parents e481ac7 + c537a7e commit 0ae5fce

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

flow/scripts/flow.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ echo Running $2.tcl, stage $1
66
$OPENROAD_EXE $OPENROAD_ARGS -exit $SCRIPTS_DIR/noop.tcl 2>&1 >$LOG_DIR/$1.tmp.log; \
77
eval "$TIME_CMD $OPENROAD_CMD -no_splash $SCRIPTS_DIR/$2.tcl -metrics $LOG_DIR/$1.json" 2>&1 | \
88
tee -a $(realpath $LOG_DIR/$1.tmp.log))
9+
# Log the hash for this step. The summary "make elapsed" in "make finish",
10+
# will not have all the .odb files for the bazel-orfs use-case.
11+
$PYTHON_EXE $UTILS_DIR/genElapsedTime.py --match $1 -d $LOG_DIR | tee -a $(realpath $LOG_DIR/$1.log)

flow/util/genElapsedTime.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

111115
def 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

Comments
 (0)