-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance tracking action (#1296)
* Fix performance tracking action Signed-off-by: elronbandel <[email protected]> * Fix Signed-off-by: elronbandel <[email protected]> * Fix Signed-off-by: elronbandel <[email protected]> * Update Signed-off-by: elronbandel <[email protected]> * try Signed-off-by: elronbandel <[email protected]> * try Signed-off-by: elronbandel <[email protected]> --------- Signed-off-by: elronbandel <[email protected]>
- Loading branch information
1 parent
12c2293
commit 1e51279
Showing
10 changed files
with
136 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import argparse | ||
import json | ||
import sys | ||
|
||
# Argument parser to get file paths from the command line | ||
parser = argparse.ArgumentParser(description="Compare performance profiles.") | ||
parser.add_argument( | ||
"main_perf_file", type=str, help="Path to main performance profile JSON file" | ||
) | ||
parser.add_argument( | ||
"pr_perf_file", type=str, help="Path to PR performance profile JSON file" | ||
) | ||
args = parser.parse_args() | ||
|
||
# Reading both performance JSON files: | ||
with open(args.main_perf_file) as openfile: | ||
main_perf = json.load(openfile) | ||
|
||
with open(args.pr_perf_file) as openfile: | ||
pr_perf = json.load(openfile) | ||
|
||
# Check for valid net_time in the main performance profile | ||
if main_perf["net_time"] == 0: | ||
print("Net run time on main is 0, can't calculate ratio of times.") | ||
sys.exit(1) | ||
|
||
# Calculate the ratio between PR and main branch net times | ||
ratio = pr_perf["net_time"] / main_perf["net_time"] | ||
|
||
# Markdown table formatting | ||
table_header = "| Branch | Net Time (seconds) | Performance Ratio |\n" | ||
table_divider = "|--------------|--------------------|-------------------|\n" | ||
table_main = f"| Main Branch | {main_perf['net_time']:<18} | - |\n" | ||
table_pr = f"| PR Branch | {pr_perf['net_time']:<18} | {ratio:.2f} |\n" | ||
|
||
# Print markdown table | ||
print("### Performance Comparison Results\n") | ||
print(table_header + table_divider + table_main + table_pr) | ||
|
||
# Performance degradation check (5% threshold) | ||
if ratio > 1.05: | ||
print("\n**Warning**: Performance degradation exceeds 5%!") | ||
print( | ||
"Explore branch performance via 'python performance_profile/card_profiler.py'," | ||
" followed by 'snakeviz performance_profile/logs/cards_benchmark.prof'." | ||
) | ||
sys.exit(1) | ||
|
||
print("\nPerformance of the PR branch is within acceptable limits.") |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters