Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 18:10
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
busybox daemons - 90% reduction in resource usage
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Tue 05 Oct 2010, 04:22    Post subject:  busybox daemons - 90% reduction in resource usage  

These tools are likely to be running in the background on many systems:
getty init klogd syslogd udhcpc
(also ash/sh but a static dietlibc version of dash is available for that)

The standard Puppy busybox (compiled with shared gnu libc and almost all applets) uses almost 2mb per instance, but by compiling just these critical apps statically against a small libc reduces this to less than 200kb each (dietlibc isn't fully compatible so I used uclibc)

Any other busybox tools that are constantly running in other popular puplets let me know... perhaps someone wants to patch freememapplet to use busybox's inotifyd instead of inotifywait?...I could add hush so it could be used for scripts, but then you would still have to mod your scripts, so may as well use dash.
busybox-daemons-1.17.2.pet
Description 
pet

 Download 
Filename  busybox-daemons-1.17.2.pet 
Filesize  52.57 KB 
Downloaded  427 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 781

PostPosted: Wed 06 Oct 2010, 11:55    Post subject:  

Great!
Small test of mem usage in 3 different situations:
    getty init klogd syslogd udhcpc: all BB = 5 x 1528K = 7640K
    getty+init+udhcpc from BB and klogd+syslogd build with static ulibc: 3 x 1528K + 164K + 192K = 4940K
    getty init klogd syslogd udhcpc from above: 192K + 192K + 184K + 188K + 188K = 944K


Not a BB thing but udevd also always runs in background. By using a static version
(download approx. midle of page) it seems you can reduce from using 1392K to approx. 248K as well. Static udevd is 82K whereas the dyn version is 63K so increase in size seems reasonably ok...
Someone with better compiling skills than I have might even reduce size of binary even more...

Concerning freememapplet_tray: Maybe a total redesign is worth thinking of - the total size of all the dependencies of freememapplet_tray is 8,8Mb!
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Wed 06 Oct 2010, 15:15    Post subject:  

thats about what I got with Rob Landley's cross compiler tools from http://impactlinux.com/aboriginal/downloads/binaries/ that I have been using instead of my devx.
(also copy include in /usr/cc and /usr/c++ to just /usr/include and link /usr/${PLATFORM}/bin/cc1 to /usr/bin (ro modify $PATH) or you'll have to add a bunch of unnecessary compiler flags)

This is what I use:
CC="gcc -muclibc" \
CFLAGS=" -Os -ffunction-sections -fdata-sections -finline-functions-called-once -march=${CROSS} -mtune=${CROSS} " \
LDFLAGS=" -Wl,-Os,--relax,--gc-sections,--sort-common,-s " \
CXXFLAGS=${CFLAGS} -fno-rtti " \
./configure --prefix=/usr ... --build=$PLATFORM --enable-static --disable-shared ....

Re: freemem
I wrote a script a while back that will write a horizontal or vertical percentage based 2-color xpm icon (it considerably speeds up Barry's partimage script and others where several images need to be created). It could probably even be modified to create a scrolling graph... the demo apps in xfree86 may be a good start for something to refresh an xpm image(s) that jwm could swallow. (same for cpu and others)... ideally one tray applet would be able to display all the icons and have a single script to either generate the icons or updates a symlink to the appropriate icon (as in blinky, volume, mail...).

btw I would have ported udevd to busybox already, but I would rather try and see if in fact mdev -d would be a suitable replacement

also it has been my experience that most CLI apps compiled statically against uclibc based libs and upx'd are roughly the same size or smaller than their shared gnu counterpart and load faster because decompression is much quicker than finding all libs and then the relocations etc...

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 781

PostPosted: Sat 09 Oct 2010, 02:46    Post subject:  

I haven't been able to figure out how to use mdev -d - at least not to do the automatic module loading - and static udev is working and small.

Concerning cli static builds the following example confirms your findings:
#dialog case
static (libc) upxed: 277K
dynamic: 103K + libncourses 220K (dialog upxed would be 51K)

Haven't been able to compile dialog against uclibc but even using normal libc the total size of the static upxed build is equivalent to the size using the dynamic build plus its libs.

Did some small test that puzzles me - viewing tops report using all BB version and using your "getty init klogd syslogd udhcpc "-static version:

BB top after boot:
mem 10360K used 836K free 324K bufff 3616 cached
"getty init klogd syslogd udhcpc "-static used after boot:
mem 10328K used 868K free 232 buff 3752 cached

It does not reflect the reported mem use for the single PIDs - why?
Is there any other way do confirm that the static build binaries uses less mem?
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 11 Oct 2010, 09:23    Post subject: looks good  

Dear technosaurus,

I have the feeling that you are on to a good thing here. Keep at it, please.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0551s ][ Queries: 12 (0.0051s) ][ GZIP on ]