Change the outout of bloat-o-meter, line wrapped at maximum 75 columns;
including 'function/old/new/delta' title and numbers, seperation line with
'-', and the last line 'Total'. Also put 'Total' numbers to the last column
in order to keep it aligned with previous 'delta' numbers.

Consider this scenario: a patch contains the output of bloat-o-meter to
clarify about the size impact/diff, and when we validate this patch with
'~/linux/scripts/checkpatch.pl' (from linux kernel source tree), which
checks for style violations, it might complain about line wrapped like:[1]
WARNING: \
Possible unwrapped commit description (prefer a maximum 75 chars per line)

Although these warnings are not harmful at all, it is helpful and makes
life easier if this kind of patch (with bloat-o-meter output) could be
passed by 'checkpatch.pl' in the first place without manually inspection.

[1] line wrapped at 75 columns:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Signed-off-by: Jones Syue <joness...@qnap.com>
---
v3:
  - keep 'Total' numbers aligned with previois 'delta' numbers
  - 'function/old/new/delta' title and numbers wrapped at max 75 columns
  - add clear intention to subject: silence patch checkers
v2: http://lists.busybox.net/pipermail/busybox/2024-March/090658.html
  - fix patch description's nit/typo with correct word 'scenario'
v1: http://lists.busybox.net/pipermail/busybox/2024-March/090656.html
---
 scripts/bloat-o-meter | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index b4a1d28113b0..651399103fbe 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -124,16 +124,16 @@ delta.reverse()
 if flag_timing:
     end_t3 = int(time.time() * 1e9)
 
-print("%-48s %7s %7s %+7s" % ("function", "old", "new", "delta"))
+print("%-48s %8s %8s %+8s" % ("function", "old", "new", "delta"))
 for d, n in delta:
     if d:
         old_sz = old.get(n, {}).get("size", "-")
         new_sz = new.get(n, {}).get("size", "-")
-        print("%-48s %7s %7s %+7d" % (n, old_sz, new_sz, d))
-print("-"*78)
-total="(add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s)%%sTotal: %s 
bytes"\
+        print("%-48s %8s %8s %+8d" % (n, old_sz, new_sz, d))
+print("-"*75)
+total="(add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s)%%sTotal bytes: 
%s"\
     % (add, remove, grow, shrink, up, -down, up-down)
-print(total % (" "*(80-len(total))))
+print(total % (" "*(77-len(total))))
 if flag_timing:
     print("\n%d/%d; %d Parse origin/new; processing nsecs" %
         (end_t1-start_t1, end_t2-start_t2, end_t3-start_t3))
-- 
2.1.4
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to