Hi Jim,
Jim Mauro wrote:
I've often struggled with this. Memory observabilty is kind of a gap
in Solaris today. DTrace is great for tracking active memory allocations
and frees, but often all you want is a memstat-like snapshot. kstats
get you close to that, but lack the granularity of memstat. I've often
kicked around writing showmem(1) - something at the command
level that covers memory usage, and includes the ever-confusing
swap/VM stuff. I haven't done it because, on the other side of this
coin, memory problems are so rare these days.
I have been working on a new dcmd in mdb allows one to walk a process'
address
space and get information about all virtual addresses that are in the
address space.
This includes physical address, (if the page is in memory), what the
page "belongs" to,
i(.e., file name, anon, swap), the location in the file or swap, and
flags (valid, in-valid, in-memory,
swapped). Right now, this is working well, and gives tons of output
depending on the
process you are examining. I plan on adding an option to give just
totals, and to
get this working also for kernel memory. Here is what output looks like
right now...
::pgrep a.out | ::print proc_t p_as | ::walk seg | ::segpages
Segment: 0X8046000-0X8047FFF maps anonymous space
VA PA FILE OFFSET
DISPOSITION
8046000 1110B000 [anon] 0 VALID
8047000 194C000 [anon] 0 VALID
Segment: 0X8050000-0X8050FFF maps from /export/home/max/a.out
VA PA FILE OFFSET DISPOSITION
8050000 13895000 a.out 0 VALID
Segment: 0X8060000-0X8060FFF maps from /export/home/max/a.out
VA PA FILE OFFSET DISPOSITION
8060000 8025000 [anon] 0 VALID
Segment: 0XCEA30000-0XCEA35FFF maps anonymous space
VA PA FILE OFFSET DISPOSITION
CEA30000 44F5000 [anon] 0 VALID
CEA31000 ADF6000 [anon] 0 VALID
CEA32000 307F7000 [anon] 0 VALID
CEA33000 - 0 INVALID
CEA34000 - 0 INVALID
CEA35000 - 0 INVALID
Segment: 0XCEA40000-0XCEB7EFFF maps from /usr/lib/libc/libc_hwcap1.so.1
VA PA FILE OFFSET DISPOSITION
CEA40000 76ABC000 libc_hwcap1.so.1 0 VALID
CEA41000 7723D000 libc_hwcap1.so.1 1000 VALID
CEA42000 7723E000 libc_hwcap1.so.1 2000 VALID
,,,
CEA79000 7789A000 libc_hwcap1.so.1 39000 VALID
CEA7A000 76D9B000 libc_hwcap1.so.1 3A000 VALID
CEA7B000 - 0 INVALID
CEA7C000 - 0 INVALID
CEA7D000 5CC1B000 libc_hwcap1.so.1 3D000
INVALID,INMEMORY
CEA7E000 396F000 libc_hwcap1.so.1 3E000
INVALID,INMEMORY
CEA7F000 37B0000 libc_hwcap1.so.1 3F000
INVALID,INMEMORY
CEA80000 6E431000 libc_hwcap1.so.1 40000
INVALID,INMEMORY
CEA81000 76BA2000 libc_hwcap1.so.1 41000
INVALID,INMEMORY
CEA82000 77CA3000 libc_hwcap1.so.1 42000 VALID
CEA83000 77CE4000 libc_hwcap1.so.1 43000 VALID
This is a little of the 500+ lines of output for main(){pause();}.
For something like firefox-bin or Xorg, there is considerably more
output. In the above, VALID means the page table entry "valid" bit is
set, InVALID means the page table entry is not valid, INMEMORY and
INVALID means the page is in memory, but the page table entry is not
marked valid (so, if the process accesses the address, it should be a
re-claim).
So, if there is interest, I'll post the source somewhere where
people can pick it up and play.
As for usefulness, other than looking and saying "oh, that's interesting
(or not)", it has
cleared up some doubts I had about pmap output. If anyone has ideas
about stuff I could add
to the output, I am happy to hear about them. Maybe it would be more
interesting
to see the effects of using liblgrp. Also, seeing where swapped pages
reside
is a bit interesting.
max
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org