From patchwork Sat Aug 17 17:18:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1148748 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iNuVkc5g"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 469n3Y4nXYz9sMr for ; Sun, 18 Aug 2019 03:19:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DD23A21F6F; Sat, 17 Aug 2019 17:19:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eLZbBFIuDd-1; Sat, 17 Aug 2019 17:18:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 3E6962156F; Sat, 17 Aug 2019 17:18:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5E6071BF402 for ; Sat, 17 Aug 2019 17:18:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4FD50879FC for ; Sat, 17 Aug 2019 17:18:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MH56My-kssNG for ; Sat, 17 Aug 2019 17:18:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0DDAA878AC for ; Sat, 17 Aug 2019 17:18:47 +0000 (UTC) Received: by mail-wm1-f51.google.com with SMTP id 207so6468720wma.1 for ; Sat, 17 Aug 2019 10:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uy96QoFpvopE7i04l+OQRDQG7HqqDcyqboq43oWE4E0=; b=iNuVkc5gthVeQmTAQicMmuE6nh9glUe6iGuPAFnIhexdS2MEs0zGbHDsvVGSYGHfgu OCcQqQ2KThKlYC0uGqBFyY1M76Ysat5gkVye4gp51DfUWtE0gd933kJ0EJr+jvj6Df3V TBJSn+GMP+nPFwZL3gIsAQ8Ko+SvjHrlPRqa8lE0OpiHojFH19DkP/3Zfhzif+/0rufa rXVW9RgjBqKGFWkInjgcXfrh3iw13BV8j90YLVwlq8kGit51bgXz7zVEA3KCy/IEYVSG ZxVlkO5AgIROUNkjhdMc9vE5eAWiOeFP2H847WN9mo5vG1d2aI8u6K98gvtRnGgqvUBT 1qfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Uy96QoFpvopE7i04l+OQRDQG7HqqDcyqboq43oWE4E0=; b=tN2K9zjMz0Pne6qKfZH3PzY/OKfLn1rvUe8Xd7/eWEgoe7R+eFrMcp3Y4ATTQp1IGk lIkkkxh6cGMG9xvCs9hMV/s5jCOqU7h0WG/ef8SudwNRSXznlJ5zhTU0G7mpqJrJZayR ynShc8vQwG3PExGPNzJsY+3GklQQ3QC1wi1cSjmyCRV+myiz7eskN8o7efIzwjEov2HB LbftRQ1xb8VYlFACSQxuct6t7FDdzq4uiSzSzuH05t/wLR5BsAkNUOKa+IFlBbt0kryk yyXmkBvM+yIZFM9I8WOshOuT7OMY/tl9BqEAW0pyB7Kxbto0AzyZBiQ8eC/NESQxdFCG GMHw== X-Gm-Message-State: APjAAAXnqsN8BoHc5JbzBqcBAhiNrekOaSPbC8M87T1qGVOdCgmII/h8 J0sxayPUvykm53FWRRTYOQR6JY7k X-Google-Smtp-Source: APXvYqwrgKQFcZYYuNXF4YEHu+nSnQo91COAWi1rVLt8P5dQpJef8qnmaQiLSRGldfKHRP/w1dCBBA== X-Received: by 2002:a1c:9889:: with SMTP id a131mr11534194wme.22.1566062325330; Sat, 17 Aug 2019 10:18:45 -0700 (PDT) Received: from localhost.localdomain (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id w13sm20864877wre.44.2019.08.17.10.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 10:18:44 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 17 Aug 2019 19:18:29 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 8/9] support/graph-size: add option to sort packages in reverse size order X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Thomas De Schampheleire Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Currently, the packages are sorted smallest first, and biggest last (with unknown and others second-to-last and last, resp.). Add an option to invert the ordering (but keeping unknown and others at their current positions). This has the nice side effect that we can now control the colours assigned to the biggest package(s), as the colours are cycled from the first to the last. Currently, the biggest packages gets a redish colour, which is appropriate, but the second gets a greenish one, which is not as appropriate (but changing that can come later). Signed-off-by: Yann E. MORIN Cc: Thomas De Schampheleire --- docs/manual/common-usage.txt | 3 +++ support/scripts/size-stats | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/manual/common-usage.txt b/docs/manual/common-usage.txt index 5653e85e12..a87980d4a2 100644 --- a/docs/manual/common-usage.txt +++ b/docs/manual/common-usage.txt @@ -329,6 +329,9 @@ to further control the generated graph. Accepted options are: * `--iec`, `--binary`, `--si`, `--decimal`, to use IEC (binary, powers of 1024) or SI (decimal, powers of 1000; the default) prefixes. +* `--biggest-first`, to sort packages in decreasing size order, rather + than in increasing size order. + .Note The collected filesystem size data is only meaningful after a complete clean rebuild. Be sure to run +make clean all+ before using +make diff --git a/support/scripts/size-stats b/support/scripts/size-stats index 5bf0ee6e95..f6b8e6644d 100755 --- a/support/scripts/size-stats +++ b/support/scripts/size-stats @@ -35,6 +35,7 @@ except ImportError: class Config(): + biggest_first = False iec = False size_limit = 0.01 colors = ['#e60004', '#009836', '#2e1d86', '#ffed00', @@ -152,7 +153,8 @@ def draw_graph(pkgsize, outputf): values = [] other_value = 0 unknown_value = 0 - for (p, sz) in sorted(pkgsize.items(), key=lambda x: x[1]): + for (p, sz) in sorted(pkgsize.items(), key=lambda x: x[1], + reverse=Config.biggest_first): if sz < (total * Config.size_limit): other_value += sz elif p == "unknown": @@ -269,6 +271,9 @@ def main(): help="CSV output file with file size statistics") parser.add_argument("--package-size-csv", '-p', metavar="PKG_SIZE_CSV", help="CSV output file with package size statistics") + parser.add_argument("--biggest-first", action='store_true', + help="Sort packages in decreasing size order, " + + "rather than in increasing size order") parser.add_argument("--iec", "--binary", "--si", "--decimal", action=PrefixAction, help="Use IEC (binary, powers of 1024) or SI (decimal, " @@ -278,6 +283,7 @@ def main(): 'the generic "Other" package. Default: 0.01 (1%%)') args = parser.parse_args() + Config.biggest_first = args.biggest_first Config.iec = args.iec if args.size_limit is not None: if args.size_limit < 0.0 or args.size_limit > 1.0: