Skip to content

Commit

Permalink
Add maximum memory used threshold levels and coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
gartung committed Jan 9, 2025
1 parent 94832c3 commit 9eaf7ab
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions comparisons/compare-maxmem-summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import glob
import re

MAXMEM_WARN_THRESHOLD = 1.0
MAXMEM_ERROR_THRESHOLD = 10.0

def KILL(message):
raise RuntimeError(message)
Expand Down Expand Up @@ -200,8 +202,22 @@ def stepfn(step):
]
summaryLine += ["<tr><td>&lt;100 * (PR - baseline)/baseline &gt;</td>"]
for step in sorted(workflows[workflow].keys(), key=stepfn):
threshold = workflows[workflow][step]["threshold"]
if not threshold:
threshold = 1.0
error_threshold = workflows[workflow][step].get("error_threshold")
if not error_threshold:
error_threshold = 10.0
cellString = "<td "
color = ""
if abs(workflows[workflow][step]["max memory pdiff"]) > MAXMEM_WARN_THRESHOLD:
color = 'bgcolor="orange"'
if abs(workflows[workflow][step]["max memory pdiff"]) > MAXMEM_ERROR_THRESHOLD:
color = 'bgcolor="red"'
cellString += color
cellString += ">"
summaryLine += [
"<td>",
cellString,
"{:,.3f}".format(workflows[workflow][step]["max memory pdiff"]),
"%</td>",
]
Expand Down Expand Up @@ -403,27 +419,13 @@ def stepfn(step):
nlalloc_base = workflows[workflow][step]["leaked alloc base"]
nlalloc_pdiff = workflows[workflow][step]["leaked alloc pdiff"]
nlalloc_adiff = workflows[workflow][step]["leaked alloc adiff"]
threshold = workflows[workflow][step]["threshold"]
if not threshold:
threshold = 1.0
error_threshold = workflows[workflow][step].get("error_threshold")
if not error_threshold:
error_threshold = 10.0
cellString = '<td align="right" '
color = ""
if abs(max_mem_pdiff) > threshold:
color = 'bgcolor="orange"'
if abs(max_mem_pdiff) > error_threshold:
color = 'bgcolor="red"'
cellString += color
cellString += ">"

if summaryFormat == "html":
summaryLines += [
'</table><table><tr><td bgcolor="orange">'
+ "warn threshold %0.2f" % threshold
+ "maximum memory used warn threshold %0.3f" % MAXMEM_WARN_THRESHOLD
+ '%</td></tr><tr><td bgcolor="red">'
+ "error threshold %0.2f" % error_threshold
+ "maximum memory used error threshold %0.3f" % MAXMEM_ERROR_THRESHOLD
+ "%</td></tr>",
]
summaryLines += ["</table></body></html>"]
Expand Down Expand Up @@ -488,9 +490,9 @@ def stepfn(step):
"--output-format",
dest="output_format",
action="store",
default="txt",
choices=["html", "txt"],
help='format of output file (must be "txt" or "html") (default: "txt")',
default="html",
choices=["html"],
help='format of output file (must be "html") (default: "html")',
)

parser.add_argument(
Expand Down

0 comments on commit 9eaf7ab

Please sign in to comment.