support/scripts: add size-stats-compare script
PATCH v3 1/1 support/scripts: add size-stats-compare script
From: Thomas De Schampheleire <[email protected]>
Leverage the CSV files produces by size-stats (make graph-size) to allow for a comparison of rootfs size between two different buildroot compilations.
The script takes the file-size CSV files of two compilations as input, and produces a textual report of the differences per package. Using the -d/--detail flag, the report will show the file size changes instead of package size changes.
The -t/--threshold option allows to ignore file size differences smaller or equal than the given threshold (in bytes).
Example output is:
Size difference per package (bytes), threshold = 0
--------------------------------------------------------------------------------
-8192 busybox
228572 added dmalloc
301584 added jq
--------------------------------------------------------------------------------
521964 TOTALor with detailed view:
Size difference per file (bytes), threshold = 0
--------------------------------------------------------------------------------
-8192 bin/busybox
18152 added usr/bin/jq
39252 added usr/bin/dmalloc
46968 added usr/lib/libdmalloc.so
47288 added usr/lib/libdmallocxx.so
47316 added usr/lib/libdmallocth.so
47748 added usr/lib/libdmallocthcxx.so
283432 added usr/lib/libjq.so.1.0.4
--------------------------------------------------------------------------------
521964 TOTAL
---
v3:
- rename this/other to old/new and swap input arguments to match 'diff'-like expectations (ThomasP)
- change visual representation
v2:
Addressing Arnout's comments:
- improve help text
- remove references to commits-to-be-backported
- fix references to 'package' while really file or package could be meant
- verify header of CSV file is as expected
- don't print output header for sections that are empty
- use <= instead of < for threshold
- use argparse.Filetype for file path verification
- use positional args for input files
- improve string wrapping
- add reference to script in manual
- ensure Python 3 compatibility
Other changes:
- also print out total size difference
- add docstrings to methods
- add TODO with possible improvements
docs/manual/common-usage.txt | 10 +++ support/scripts/size-stats-compare | 127 +++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100755 support/scripts/size-stats-compare
docs/manual/common-usage.txt +10 -0
@@ -317,6 +317,16 @@ The collected filesystem size data is only meaningful after a complete clean rebuild. Be sure to run +make clean all+ before using +make graph-size+. +To compare the root filesystem size of two different Buildroot compilations, +for example after adjusting the configuration or when switching to another +Buildroot release, use the +size-stats-compare+ script. It takes two ++file-size-stats.csv+ files (produced by +make graph-size+) as input. +Refer to the help text of this script for more details: + +---------------- +support/scripts/size-stats-compare -h +---------------- + include::eclipse-integration.txt[] include::advanced.txt[]
support/scripts/size-stats-compare new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.4.10
Thomas Petazzoni
AppliedPATCH v3 1/1 support/scripts: add size-stats-compare script
Dear Thomas De Schampheleire,
Quoted 15 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
Leverage the CSV files produces by size-stats (make graph-size) to allow for a comparison of rootfs size between two different buildroot compilations.
The script takes the file-size CSV files of two compilations as input, and produces a textual report of the differences per package. Using the -d/--detail flag, the report will show the file size changes instead of package size changes.
The -t/--threshold option allows to ignore file size differences smaller or equal than the given threshold (in bytes).Example output is:
Quoted 7 lines
Size difference per package (bytes), threshold = 0
---------------------------------------------------------------------------------8192 busybox 228572 added dmalloc 301584 added jq -------------------------------------------------------------------------------- 521964 TOTAL
Applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com