libmemstat(3) - Library for monitoring kernel memory use
Robert Watson
rwatson at FreeBSD.org
Thu Jul 14 20:09:06 GMT 2005
On Thu, 14 Jul 2005, Julian Elischer wrote:
>> I've put some sample code for using libmemstat(3) up at the following URL:
>>
>> http://www.watson.org/~robert/freebsd/libmemstat/
>
> cool. got sample output?
Re-added the CC in case anyone else is interested.
As I said, I'm no ncurses expert, but the output from my memtop(8) is
suggestive of what might be accomplished by someone with a bit more clue
than me. memtop is running "-a", meaning use all available allocators
(uma and malloc), and is sorting by the total number of operations per
type, which is sometimes but not always the same as the total amount of
data by type, or the absolute value of the delta change in allocations or
bytes. I've tweaked memtop(8) to use a 5 second delay below, something
that currently requires a source code change:
As I log in via SSH:
Type Alloc #Alloc'd #Free'd Delta DeltaBytes
PV ENTRY uma 6025 3911 2114 50736
NAMEI uma 529 529 0 0
MAP ENTRY uma 568 388 180 12240
128 uma 254 143 111 14208
VM OBJECT uma 244 142 102 13464
Files uma 192 183 9 648
Mbuf uma 132 132 0 0
cred malloc 92 88 4 512
soname malloc 70 70 0 0
ttys malloc 105 0 105 13440
ioctlops malloc 51 51 0 0
16 uma 49 49 0 0
64 uma 47 45 2 128
Packet uma 36 36 0 0
256 uma 26 22 4 1024
32 uma 25 21 4 128
socket uma 23 20 3 1068
temp malloc 17 17 0 0
unpcb uma 17 15 2 280
4096 uma 13 10 3 12288
proc-args malloc 12 9 3 96
plimit malloc 11 10 1 256
sysctl malloc 9 9 0 0
As i run du from an SSH session:
Type Alloc #Alloc'd #Free'd Delta DeltaBytes
NAMEI uma 31177 31177 0 0
S VFS Cache uma 26957 8370 18587 1263916
VNODE uma 23416 7052 16364 4451008
FFS inode uma 23416 6942 16474 2174568
FFS2 dinode uma 23416 6942 16474 4217344
g_bio uma 7016 7020 -4 -528
KMAP ENTRY uma 3295 3296 -1 -68
Files uma 2720 2721 -1 -72
Mbuf uma 2540 2541 -1 -256
ata_request uma 1886 1888 -2 -400
VM OBJECT uma 1359 7 1352 178464
Packet uma 632 633 -1 -256
PV ENTRY uma 233 90 143 3432
L VFS Cache uma 136 80 56 16296
DIRHASH uma 107 0 107 109568
ufs_dirhash malloc 93 0 93 17328
16 uma 47 2 45 720
UMA Slabs uma 40 2 38 2432
512 uma 31 0 31 15872
32 uma 17 4 13 416
NFSNODE uma 0 13 -13 -5980
sysctl malloc 6 6 0 0
128 Bucket uma 10 0 10 5240
As I run ping -f on a serial console:
Type Alloc #Alloc'd #Free'd Delta DeltaBytes
Mbuf uma 7236 7235 1 256
16 uma 4100 4100 0 0
soname malloc 2905 2905 0 0
Packet uma 1978 1978 0 0
iov malloc 1194 1194 0 0
PV ENTRY uma 80 47 33 792
sysctl malloc 6 6 0 0
KMAP ENTRY uma 4 4 0 0
32 uma 4 4 0 0
temp malloc 2 2 0 0
UMA Slabs uma 2 2 0 0
64 uma 1 1 0 0
ioctlops malloc 1 1 0 0
MAP ENTRY uma 1 1 0 0
As I run netblast with 0-byte UDP packets:
Type Alloc #Alloc'd #Free'd Delta DeltaBytes
Mbuf uma 292138 292135 3 768
Packet uma 796 796 0 0
g_bio uma 76 76 0 0
PV ENTRY uma 80 47 33 792
ata_request uma 23 23 0 0
sysctl malloc 6 6 0 0
32 uma 4 4 0 0
KMAP ENTRY uma 4 4 0 0
temp malloc 2 2 0 0
16 uma 2 2 0 0
UMA Slabs uma 2 2 0 0
MAP ENTRY uma 1 1 0 0
ioctlops malloc 1 1 0 0
64 uma 1 1 0 0
Robert N M Watson
More information about the freebsd-current
mailing list