Skip to content

Commit 17b5969

Browse files
committed
Update baselines per CPU
Signed-off-by: Diana Popa <dpopa@amazon.com>
1 parent 8a46721 commit 17b5969

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tools/parse_baselines/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,25 @@ def main():
145145
encoding="utf8",
146146
) as baselines_file:
147147
json_baselines = json.load(baselines_file)
148+
current_cpus = json_baselines["hosts"]["instances"][args.instance]["cpus"]
148149
cpus = parser.parse()
149-
json_baselines["hosts"]["instances"][args.instance] = {"cpus": cpus}
150150

151+
for cpu in cpus:
152+
model = cpu["model"]
153+
for old_cpu in current_cpus:
154+
if old_cpu["model"] == model:
155+
old_cpu["baselines"] = cpu["baselines"]
151156
baselines_file.truncate(0)
152157
baselines_file.seek(0, 0)
153158
json.dump(json_baselines, baselines_file, indent=4)
154159

160+
# Warn against the fact that not all CPUs pertaining to
161+
# some arch were updated.
162+
assert len(cpus) == len(current_cpus), (
163+
"It may be that only a subset of CPU types were updated! "
164+
"Need to run again! Nevertheless we updated the baselines..."
165+
)
166+
155167

156168
if __name__ == "__main__":
157169
main()

0 commit comments

Comments
 (0)