[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Ksysguard is useless!
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-01-03 22:25:01
Message-ID: 200701032025.09259.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


John Tapsell wrote:
>> is it possible to split out where the memory usage is coming from
>> (e.g. ksysguard itself vs stuff in kdelibs)?
>
>The kernel won't tell you what pages go with what processes, for
>several reasons including security.  However there is a kernel module
>and tool that will give you this information, called  ezmap.
>More info about both is at http://koltsoff.com/pub/ures/

I don't think that's what Aaron wanted, actually.

Using pmap (/proc/PID/maps on Linux), you get a list of all memory 
mappings on a process. You'll get the mapping per memory region, which 
you can probably fit into one of these categories:

1) anonymous blocks and stack
    not shared
2) read-only mappings
    shareable
3) read & write mappings
    a) clean pages: shared
    b) dirty pages: not shared

The difference between shareable and shared is if anything else is using 
the same mapping. If it's libc or a kdelibs library, it's shared. If it's 
a library specific to the given program (like a kdeinit 
KUniqueApplication program), it's not most likely shared.

The difficulty here is finding out how much of the heap was allocated due 
to kdelibs and how much was allocated due to the application itself. 
Though I think it doesn't really matter who caused the allocation: it was 
allocated because the app was started.

I've just found out that /proc/PID/smaps (on Linux) contains extra 
information that may help shed more light on the subject. It's 
actually /proc/PID/maps with extra information per mapping. That 
information helps tell apart shared from shareable and clean from dirty.

Here's the output for ksysguard (from KDE3):
$ perl -ne 'if (/(Private|Shared)_(Clean|Dirty): *(\d+) kB/) { 
$totals{"$1_$2"} += $3; } END { foreach $key (keys %totals) { $total += 
$totals{$key}; print "$key: ".$totals{$key}."\n"; } print "Total: 
$total\n"; }' /proc/`pidof ksysguard`/smaps
Private_Dirty: 3176
Private_Clean: 532
Shared_Clean: 14436
Shared_Dirty: 0
Total: 18144

$ ps -o rss,vsz,cmd `pidof ksysguard`
  RSS    VSZ CMD
18144  32940 ksysguard --showprocesses

As you can see from that output, ksysguard's impact on the system is 3708 
kB, of which 532 kB could be discarded if needed. Of those 3708 kB, we 
can also see that 44 kB are the stack and 1980 kB is heap.

Compare that to the 32.9 MB of VSZ.

Also for comparison, the results of a highly swapped-out program 
(kwrapper) against two large programs (X and kontact):
			kontact kwrapper X
Private_Dirty: 	20700   4       26252
Private_Clean:	11844   20      9768
Shared_Clean:	20292   172     544
Shared_Dirty:	0       0       0
Heap:		18424  132      0 (?)
Total:		52836  196      36564

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic