Skip to content

Commit

Permalink
Avoid divide by zero in superpmi.py tpdiff (#74291)
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceForstall authored Aug 22, 2022
1 parent 20aa900 commit 0588129
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/coreclr/scripts/superpmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1956,9 +1956,12 @@ def replay_with_throughput_diff(self):

logging.info("Total instructions executed by base: {}".format(base_instructions))
logging.info("Total instructions executed by diff: {}".format(diff_instructions))
delta_instructions = diff_instructions - base_instructions
logging.info("Total instructions executed delta: {} ({:.2%} of base)".format(delta_instructions, delta_instructions / base_instructions))
tp_diffs.append((os.path.basename(mch_file), base_instructions, diff_instructions))
if base_instructions != 0 and diff_instructions != 0:
delta_instructions = diff_instructions - base_instructions
logging.info("Total instructions executed delta: {} ({:.2%} of base)".format(delta_instructions, delta_instructions / base_instructions))
tp_diffs.append((os.path.basename(mch_file), base_instructions, diff_instructions))
else:
logging.warning("One compilation failed to produce any results")
else:
logging.warning("No metric files present?")

Expand Down

0 comments on commit 0588129

Please sign in to comment.