From patchwork Tue Jan 6 22:03:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1319 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737136; bh=FlQfEodLXWRDFJ9PPqJmDC/vIF/QLQJjxU6aKKhvwP0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kZNhou5tMNryCnA3djLbKfOTQK3GAuUdbSeW3Uk9TMHdIA2cqdMyLm6oGqBTLHXAH PDNPgqRtq5d+xgcBIWqHrnlrGsXueQRZHn8RfwRvg8T27IMcpQDdNNhOpPFCRcCj7g T1K8IbWVigBZi+MFvbAslKaVBqkIjXzY+vmY6j9+T9AcBL/J7so09ZTH8+e1M+UyUN i6W1lNdIxsPidb5mJjTgQRexH1mCetNmvOG1vTReAaeHpldJigflOFYmeFLMG/ju4Y vPCckPaV+gY2+4TLaQYnLEoKgff8UivF/vr71n6kuDjwUZOl9PPenvyn2NxLKTCl1t QeqM0PWrxRVHA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 16A165FF82 for ; Tue, 6 Jan 2026 15:05:36 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OBk8F-xDAw_v for ; Tue, 6 Jan 2026 15:05:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737136; bh=FlQfEodLXWRDFJ9PPqJmDC/vIF/QLQJjxU6aKKhvwP0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kZNhou5tMNryCnA3djLbKfOTQK3GAuUdbSeW3Uk9TMHdIA2cqdMyLm6oGqBTLHXAH PDNPgqRtq5d+xgcBIWqHrnlrGsXueQRZHn8RfwRvg8T27IMcpQDdNNhOpPFCRcCj7g T1K8IbWVigBZi+MFvbAslKaVBqkIjXzY+vmY6j9+T9AcBL/J7so09ZTH8+e1M+UyUN i6W1lNdIxsPidb5mJjTgQRexH1mCetNmvOG1vTReAaeHpldJigflOFYmeFLMG/ju4Y vPCckPaV+gY2+4TLaQYnLEoKgff8UivF/vr71n6kuDjwUZOl9PPenvyn2NxLKTCl1t QeqM0PWrxRVHA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 023F369146 for ; Tue, 6 Jan 2026 15:05:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737133; bh=oVMYQDFUC0QvQJuqdyneTUAK8IBBc2cCn0oeVt4uckA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U25yZJIL/Nsd6ooal5B3dGIbDMfX981E4KQJ1JBZjM7hA01JStpozrf2ZvPicnaZG qrfFJQ+iH6MRocNpXkWhBtdnz69e9/ixDuNcZDCWxGeE76thiBRqeM9BvUkRraDRYX zGwObRb9HRnL3NtNTd/+lwhk/FzIy8chopdXOQCfxXbKZ4sux1sHUBVvjasq7w4cIP vXaFu3QU8Y6RmF+jp5Sj5jHleJ0sf/HF2PBFDF1XpluO7W3Tk6XZqYzWJibKQ3UIsc hgN7hFB/sXHDewHV1Aa+zBCVjo8ILNCT4maNqar9eMzuWThoEFq49tUFddaGhl8rXK gqXqK0cPHDBRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8861E5FF82; Tue, 6 Jan 2026 15:05:33 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id VgI3zh5a45US; Tue, 6 Jan 2026 15:05:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737129; bh=ghC/zIAWT92V+FFWqevkyWP2JXZvhgDr3PsdQbB+Au8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlVgi/BaLD9VX1uwmjs8IZU1r/oZQq/1HL3mLrbF+Wvd6tSOgVe7qXYNdYVliNloe 2TK91IvNaGjmrn+fMe0/buHEbEtOCiTyzWtt5JnHwGEDxE8LKl+l49BxqUR72zNgSK fAxPz2fOJUWlJDKfIHUtufz3m/6wOXJ/lKzsJliVTkqo5XmH2DoEZR0ojJKDFbx99H XYwM35CdFzmHfdReDwhCppHFQ22vu5n6S3WWJLq4hFYxuoYcFeH8QmXldJvliraD6N NVoBKPFTJkshycsg5RtKuqeRWNnNlgnYTKfT3Hv7QWdZEgTrxJQv+Iio2v7X4nHMxh EjA/Bby5XaUUA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1333F690CB; Tue, 6 Jan 2026 15:05:29 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 15:03:34 -0700 Message-ID: <20260106220403.2915630-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106220403.2915630-1-sjg@u-boot.org> References: <20260106220403.2915630-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: AWDGNSSHF6PMTTDVBYF6QODD67QBCOI2 X-Message-ID-Hash: AWDGNSSHF6PMTTDVBYF6QODD67QBCOI2 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 16/29] buildman: Refactor print_size_summary() in builder.py List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Extract the 'for target' loop into _calc_size_changes() to improve readability and reduce complexity in print_size_summary() Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/builder.py | 51 +++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 172a8970ec9..f1fbdc7b888 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1241,32 +1241,26 @@ class Builder: outcome.func_sizes[fname]) - def print_size_summary(self, board_selected, board_dict, show_detail, - show_bloat): - """Print a summary of image sizes broken down by section. + def _calc_size_changes(self, board_selected, board_dict): + """Calculate changes in size for different image parts - The summary takes the form of one line per architecture. The - line contains deltas for each of the sections (+ means the section - got bigger, - means smaller). The numbers are the average number - of bytes that a board in this section increased by. - - For example: - powerpc: (622 boards) text -0.0 - arm: (285 boards) text -0.0 + The previous sizes are in Board.sizes, for each board Args: board_selected (dict): Dict containing boards to summarise, keyed by board.target board_dict (dict): Dict containing boards for which we built this commit, keyed by board.target. The value is an Outcome object. - show_detail (bool): Show size delta detail for each board - show_bloat (bool): Show detail for each function + + Returns: + tuple: (arch_list, arch_count) where: + arch_list: dict keyed by arch name, containing a list of + size-change dicts + arch_count: dict keyed by arch name, containing the number of + boards for that arch """ arch_list = {} arch_count = {} - - # Calculate changes in size for different image parts - # The previous sizes are in Board.sizes, for each board for target in board_dict: if target not in board_selected: continue @@ -1303,6 +1297,31 @@ class Builder: arch_list[arch] = [err] else: arch_list[arch].append(err) + return arch_list, arch_count + + def print_size_summary(self, board_selected, board_dict, show_detail, + show_bloat): + """Print a summary of image sizes broken down by section. + + The summary takes the form of one line per architecture. The + line contains deltas for each of the sections (+ means the section + got bigger, - means smaller). The numbers are the average number + of bytes that a board in this section increased by. + + For example: + powerpc: (622 boards) text -0.0 + arm: (285 boards) text -0.0 + + Args: + board_selected (dict): Dict containing boards to summarise, keyed + by board.target + board_dict (dict): Dict containing boards for which we built this + commit, keyed by board.target. The value is an Outcome object. + show_detail (bool): Show size delta detail for each board + show_bloat (bool): Show detail for each function + """ + arch_list, arch_count = self._calc_size_changes(board_selected, + board_dict) # We now have a list of image size changes sorted by arch # Print out a summary of these