summaryrefslogtreecommitdiff
path: root/tools/metrics.py
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-12-04 21:34:10 +0700
committerGitHub <[email protected]>2025-12-04 21:34:10 +0700
commite7105b1fa3ccd8200fe7fb8b0759d00afc9b07c1 (patch)
tree47beee5979266c979664293bae83a627f540d213 /tools/metrics.py
parentf68e354729c9485918966d2818fe652c033e4a93 (diff)
fine tune ci to build more with circleci (#3386)
* fine tune ci to build more with circleci * skip make for arm-iar, esp-idf * skip make + clang for circleci since llvm-objcopy got killed due to memory issue.
Diffstat (limited to 'tools/metrics.py')
-rw-r--r--tools/metrics.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/tools/metrics.py b/tools/metrics.py
index bb84f803e..c3b366e42 100644
--- a/tools/metrics.py
+++ b/tools/metrics.py
@@ -195,17 +195,13 @@ def compare_maps(base_file, new_file, filters=None):
def format_diff(base, new, diff):
"""Format a diff value with percentage."""
- if base == 0 and new == 0:
- return "0"
- if base == 0:
- return f"{new} (new)"
- if new == 0:
- return f"{base} ➡ 0"
if diff == 0:
- return f"{base} ➡ {new}"
+ return f"{new}"
+ if base == 0 or new == 0:
+ return f"{base} ➙ {new}"
pct = (diff / base) * 100
sign = "+" if diff > 0 else ""
- return f"{base} ➡ {new} ({sign}{diff}, {sign}{pct:.1f}%)"
+ return f"{base} ➙ {new} ({sign}{diff}, {sign}{pct:.1f}%)"
def get_sort_key(sort_order):
@@ -232,10 +228,11 @@ def write_compare_markdown(comparison, path, sort_order='size'):
sections = comparison["sections"]
md_lines = [
- "# TinyUSB Code Size Different Report",
+ "# Size Difference Report",
"",
- f"**Base:** `{comparison['base_file']}`",
- f"**New:** `{comparison['new_file']}`",
+ "Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds."
+ "",
+ "Note: If there is no change, only one value is shown.",
"",
]