* [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result
@ 2021-03-03 15:04 Thomas De Schampheleire
2021-03-03 15:04 ` [Buildroot] [PATCHv2 2/2] utils/size-stats-compare: add package name in detail output Thomas De Schampheleire
2022-01-31 20:38 ` [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Arnout Vandecappelle
0 siblings, 2 replies; 4+ messages in thread
From: Thomas De Schampheleire @ 2021-03-03 15:04 UTC (permalink / raw)
To: buildroot
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
print_result is juggling with entry[x][y] which is not very readable.
While a better solution would be to use a class and reference named
attributes, that would require some bigger changes in the script.
Instead, make a minimal improvement by assigning the entry[x][y] values to
intermediate variables. Store them in a dict for easy usage from a format
string.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
v2: new patch
utils/size-stats-compare | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/utils/size-stats-compare b/utils/size-stats-compare
index a3d7f250c6..de67b72587 100755
--- a/utils/size-stats-compare
+++ b/utils/size-stats-compare
@@ -77,9 +77,16 @@ def print_results(result, threshold):
# list_result is a list of tuples: (name, (flag, size difference))
for entry in sorted(list_result, key=lambda entry: entry[1][1]):
- if threshold is not None and abs(entry[1][1]) <= threshold:
+
+ data = dict(
+ name=entry[0],
+ action=entry[1][0],
+ size=entry[1][1],
+ )
+
+ if threshold is not None and abs(data['size']) <= threshold:
continue
- print('%12s %7s %s' % (entry[1][1], entry[1][0], entry[0]))
+ print('{size:12d} {action:7s} {name}'.format(**data))
# main #########################################################################
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCHv2 2/2] utils/size-stats-compare: add package name in detail output
2021-03-03 15:04 [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Thomas De Schampheleire
@ 2021-03-03 15:04 ` Thomas De Schampheleire
2022-01-31 20:38 ` [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Arnout Vandecappelle
1 sibling, 0 replies; 4+ messages in thread
From: Thomas De Schampheleire @ 2021-03-03 15:04 UTC (permalink / raw)
To: buildroot
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
size-stats-compare gives an overview of the size increase/decrease between
two cases, based on packages-file-list.txt. The 'detail' mode gives info per
file, otherwise per package.
But sometimes, you want the detailed per-file info, but only for a specific
package. Since the detailed output no longer lists the package name, you
cannot simply grep for it. A workaround was to filter the input
packages-file-list.txt's first, and then pass these filtered versions to
size-stats-compare.
Make this easier by adding the package name next to the filename in detailed
output. This allows grep'ing normally.
For example:
$ utils/size-stats-compare orig new -t 100 -d | grep ebtables
-67712 removed ebtables lib/ebtables/libebtc.so
-66764 removed ebtables lib/ebtables/libebt_nat.so
-66752 removed ebtables sbin/ebtables
-66704 removed ebtables lib/ebtables/libebt_arp.so
-66700 removed ebtables lib/ebtables/libebt_stp.so
-66700 removed ebtables lib/ebtables/libebt_among.so
-66684 removed ebtables lib/ebtables/libebt_ip.so
-66676 removed ebtables lib/ebtables/libebt_limit.so
-66656 removed ebtables lib/ebtables/libebt_log.so
-66648 removed ebtables lib/ebtables/libebt_mark.so
-66636 removed ebtables lib/ebtables/libebt_pkttype.so
-66604 removed ebtables lib/ebtables/libebt_vlan.so
-66588 removed ebtables lib/ebtables/libebt_ulog.so
-66588 removed ebtables lib/ebtables/libebt_nflog.so
-66584 removed ebtables lib/ebtables/libebt_arpreply.so
-66544 removed ebtables lib/ebtables/libebt_ip6.so
-66540 removed ebtables lib/ebtables/libebt_802_3.so
-66536 removed ebtables lib/ebtables/libebt_standard.so
-66524 removed ebtables lib/ebtables/libebt_mark_m.so
-66524 removed ebtables lib/ebtables/libebt_redirect.so
-66452 removed ebtables lib/ebtables/libebtable_filter.so
-66452 removed ebtables lib/ebtables/libebtable_broute.so
-66452 removed ebtables lib/ebtables/libebtable_nat.so
45 ebtables etc/ethertypes
66752 added ebtables usr/sbin/ebtablesd
66752 added ebtables usr/sbin/ebtables-legacy
66752 added ebtables usr/sbin/ebtablesu
200840 added ebtables usr/lib/libebtc.so.0.0.0
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
v2: move package name in front of filename (comment by Yann)
utils/size-stats-compare | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/utils/size-stats-compare b/utils/size-stats-compare
index de67b72587..ffe894e839 100755
--- a/utils/size-stats-compare
+++ b/utils/size-stats-compare
@@ -40,9 +40,9 @@ def read_file_size_csv(inputf, detail=None):
for row in reader:
if detail:
- sizes[row[0]] = int(row[2])
+ sizes[(row[0], row[1])] = int(row[2])
else:
- sizes[row[1]] = int(row[3])
+ sizes[(None, row[1])] = int(row[3])
return sizes
@@ -73,20 +73,28 @@ def print_results(result, threshold):
from six import iteritems
list_result = list(iteritems(result))
- # result is a dictionary: name -> (flag, size difference)
- # list_result is a list of tuples: (name, (flag, size difference))
+ # result is a dictionary: (filename, pkgname) -> (flag, size difference)
+ # list_result is a list of tuples: ((filename, pkgname), (flag, size difference))
+ # filename may be None if no detail is requested.
+
+ maxpkgname=max(len(pkgname) for filename, pkgname in result)
for entry in sorted(list_result, key=lambda entry: entry[1][1]):
data = dict(
- name=entry[0],
+ filename=entry[0][0],
+ pkgname=entry[0][1],
action=entry[1][0],
size=entry[1][1],
+ maxpkgname=maxpkgname,
)
if threshold is not None and abs(data['size']) <= threshold:
continue
- print('{size:12d} {action:7s} {name}'.format(**data))
+ if data['filename']:
+ print('{size:12d} {action:7s} {pkgname:{maxpkgname}s} {filename}'.format(**data))
+ else:
+ print('{size:12d} {action:7s} {pkgname}'.format(**data))
# main #########################################################################
@@ -133,5 +141,5 @@ print('Size difference per %s (bytes), threshold = %s' % (keyword, args.threshol
print(80*'-')
print_results(delta, args.threshold)
print(80*'-')
-print_results({'TOTAL': ('', sum(new_sizes.values()) - sum(old_sizes.values()))},
+print_results({(None, 'TOTAL'): ('', sum(new_sizes.values()) - sum(old_sizes.values()))},
threshold=None)
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result
2021-03-03 15:04 [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Thomas De Schampheleire
2021-03-03 15:04 ` [Buildroot] [PATCHv2 2/2] utils/size-stats-compare: add package name in detail output Thomas De Schampheleire
@ 2022-01-31 20:38 ` Arnout Vandecappelle
2022-02-01 8:55 ` Thomas De Schampheleire
1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2022-01-31 20:38 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot
Cc: Yann E . MORIN, Thomas De Schampheleire
On 03/03/2021 16:04, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> print_result is juggling with entry[x][y] which is not very readable.
> While a better solution would be to use a class and reference named
> attributes, that would require some bigger changes in the script.
>
> Instead, make a minimal improvement by assigning the entry[x][y] values to
> intermediate variables. Store them in a dict for easy usage from a format
> string.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Series applied to master, thanks.
It's a bit silly that this has to take a year, but it is what it is...
Regards,
Arnout
> ---
> v2: new patch
>
> utils/size-stats-compare | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/utils/size-stats-compare b/utils/size-stats-compare
> index a3d7f250c6..de67b72587 100755
> --- a/utils/size-stats-compare
> +++ b/utils/size-stats-compare
> @@ -77,9 +77,16 @@ def print_results(result, threshold):
> # list_result is a list of tuples: (name, (flag, size difference))
>
> for entry in sorted(list_result, key=lambda entry: entry[1][1]):
> - if threshold is not None and abs(entry[1][1]) <= threshold:
> +
> + data = dict(
> + name=entry[0],
> + action=entry[1][0],
> + size=entry[1][1],
> + )
> +
> + if threshold is not None and abs(data['size']) <= threshold:
> continue
> - print('%12s %7s %s' % (entry[1][1], entry[1][0], entry[0]))
> + print('{size:12d} {action:7s} {name}'.format(**data))
>
>
> # main #########################################################################
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result
2022-01-31 20:38 ` [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Arnout Vandecappelle
@ 2022-02-01 8:55 ` Thomas De Schampheleire
0 siblings, 0 replies; 4+ messages in thread
From: Thomas De Schampheleire @ 2022-02-01 8:55 UTC (permalink / raw)
To: Arnout Vandecappelle; +Cc: Yann E . MORIN, Thomas De Schampheleire, buildroot
El lun, 31 ene 2022 a las 21:38, Arnout Vandecappelle
(<arnout@mind.be>) escribió:
>
>
>
> On 03/03/2021 16:04, Thomas De Schampheleire wrote:
> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >
> > print_result is juggling with entry[x][y] which is not very readable.
> > While a better solution would be to use a class and reference named
> > attributes, that would require some bigger changes in the script.
> >
> > Instead, make a minimal improvement by assigning the entry[x][y] values to
> > intermediate variables. Store them in a dict for easy usage from a format
> > string.
> >
> > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> Series applied to master, thanks.
>
> It's a bit silly that this has to take a year, but it is what it is...
No worries, thanks in any case!
/Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-01 8:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 15:04 [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Thomas De Schampheleire
2021-03-03 15:04 ` [Buildroot] [PATCHv2 2/2] utils/size-stats-compare: add package name in detail output Thomas De Schampheleire
2022-01-31 20:38 ` [Buildroot] [PATCHv2 1/2] utils/size-stats-compare: clarify meaning of variables in print_result Arnout Vandecappelle
2022-02-01 8:55 ` Thomas De Schampheleire
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.