* [PATCH] add option --printsize
@ 2012-05-21 8:37 Dave Young
[not found] ` <20120521083706.GA3040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Dave Young @ 2012-05-21 8:37 UTC (permalink / raw)
To: harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA
Cc: vgoyal-H+wXaHxf7aLQT0dZR+AlfA,
xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w,
dyoung-H+wXaHxf7aLQT0dZR+AlfA
Add --printsize for measuring module installed size to initramfs
Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
dracut.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
--- dracut.orig/dracut.sh 2012-05-21 16:32:17.980074395 +0800
+++ dracut/dracut.sh 2012-05-21 16:32:57.450074527 +0800
@@ -123,6 +123,7 @@ Creates initial ramdisk images for prelo
-M, --show-modules Print included module's name to standard output during
build.
--keep Keep the temporary initramfs for debugging purposes
+ --printsize Print out the module install size
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -268,6 +269,7 @@ while (($# > 0)); do
show_modules_l="yes"
;;
--keep) keep="yes";;
+ --printsize) printsize="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*)
if ! [[ ${outfile+x} ]]; then
@@ -700,6 +702,7 @@ mods_to_load=""
for_each_module_dir check_module
for_each_module_dir check_mount
+_isize=0 #initramfs size
modules_loaded=" "
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
@@ -717,6 +720,14 @@ for moddir in "$dracutbasedir/modules.d"
fi
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
+
+ #print the module install size
+ if [ -n "$printsize" ]; then
+ _isize_new=$(du -sk ${initdir}|cut -f1)
+ _isize_delta=$(($_isize_new - $_isize))
+ echo "$_d_mod install size: ${_isize_delta}k"
+ _isize=$_isize_new
+ fi
fi
done
unset moddir
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add option --printsize
[not found] ` <20120521083706.GA3040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2012-05-21 8:43 ` Cong Wang
[not found] ` <4FBA003D.50103-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Cong Wang @ 2012-05-21 8:43 UTC (permalink / raw)
To: Dave Young
Cc: harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA,
vgoyal-H+wXaHxf7aLQT0dZR+AlfA
On 05/21/2012 04:37 PM, Dave Young wrote:
> Add --printsize for measuring module installed size to initramfs
>
...
> +
> + #print the module install size
> + if [ -n "$printsize" ]; then
> + _isize_new=$(du -sk ${initdir}|cut -f1)
> + _isize_delta=$(($_isize_new - $_isize))
> + echo "$_d_mod install size: ${_isize_delta}k"
> + _isize=$_isize_new
> + fi
> fi
Yeah, it is a nice feature, to calculate the module installation size by
delta of the whole initrd size.
Could you include the sample output in the changelog?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add option --printsize
[not found] ` <4FBA003D.50103-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-05-21 8:50 ` Harald Hoyer
[not found] ` <4FBA01ED.2000001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Harald Hoyer @ 2012-05-21 8:50 UTC (permalink / raw)
To: Cong Wang
Cc: Dave Young, initramfs-u79uwXL29TY76Z2rM5mHXA,
vgoyal-H+wXaHxf7aLQT0dZR+AlfA
Am 21.05.2012 10:43, schrieb Cong Wang:
> On 05/21/2012 04:37 PM, Dave Young wrote:
>> Add --printsize for measuring module installed size to initramfs
>>
> ...
>> +
>> + #print the module install size
>> + if [ -n "$printsize" ]; then
>> + _isize_new=$(du -sk ${initdir}|cut -f1)
>> + _isize_delta=$(($_isize_new - $_isize))
>> + echo "$_d_mod install size: ${_isize_delta}k"
>> + _isize=$_isize_new
>> + fi
>> fi
>
> Yeah, it is a nice feature, to calculate the module installation size by delta
> of the whole initrd size.
>
> Could you include the sample output in the changelog?
>
> Thanks.
What about files used by many modules, like shared libraries and tools? The
output should be taken with a grain of salt.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add option --printsize
[not found] ` <4FBA01ED.2000001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-05-21 8:57 ` Dave Young
0 siblings, 0 replies; 4+ messages in thread
From: Dave Young @ 2012-05-21 8:57 UTC (permalink / raw)
To: Harald Hoyer
Cc: Cong Wang, initramfs-u79uwXL29TY76Z2rM5mHXA,
vgoyal-H+wXaHxf7aLQT0dZR+AlfA
On 05/21/2012 04:50 PM, Harald Hoyer wrote:
> Am 21.05.2012 10:43, schrieb Cong Wang:
>> On 05/21/2012 04:37 PM, Dave Young wrote:
>>> Add --printsize for measuring module installed size to initramfs
>>>
>> ...
>>> +
>>> + #print the module install size
>>> + if [ -n "$printsize" ]; then
>>> + _isize_new=$(du -sk ${initdir}|cut -f1)
>>> + _isize_delta=$(($_isize_new - $_isize))
>>> + echo "$_d_mod install size: ${_isize_delta}k"
>>> + _isize=$_isize_new
>>> + fi
>>> fi
>>
>> Yeah, it is a nice feature, to calculate the module installation size by delta
>> of the whole initrd size.
>>
>> Could you include the sample output in the changelog?
Hi cong, I just reply here of a sample, will add it if need a v2 patch:
[dave@localhost dracut]$ ./dracut.sh -l --printsize test.img 2>/dev/null
dash install size: 2372k
caps install size: 1148k
i18n install size: 3144k
rpmversion install size: 4k
network install size: 8688k
ifcfg install size: 8k
plymouth install size: 26000k
btrfs install size: 336k
crypt install size: 2572k
dm install size: 252k
dmraid install size: 356k
kernel-modules install size: 55548k
lvm install size: 2016k
mdraid install size: 800k
multipath install size: 748k
fcoe install size: 780k
iscsi install size: 520k
nfs install size: 22096k
resume install size: 12k
rootfs-block install size: 12k
terminfo install size: 60k
udev-rules install size: 956k
virtfs install size: 380k
biosdevname install size: 92k
usrmount install size: 4k
base install size: 1348k
fs-lib install size: 2324k
shutdown install size: 396k
>>
>> Thanks.
>
> What about files used by many modules, like shared libraries and tools? The
> output should be taken with a grain of salt.
This rough printing at least can help use measure the module install
size which is not shared. It is the increased size directly caused by
the specific module_install.
Shared libraries is not considered here. It's hard to measure the shared
part.. Do you have any idea or suggestions?
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Thanks
Dave
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-21 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-21 8:37 [PATCH] add option --printsize Dave Young
[not found] ` <20120521083706.GA3040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2012-05-21 8:43 ` Cong Wang
[not found] ` <4FBA003D.50103-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-21 8:50 ` Harald Hoyer
[not found] ` <4FBA01ED.2000001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-05-21 8:57 ` Dave Young
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox