gianluca wrote:
I'm writing a small application to collect memory information about
the local zones from the global zone...
My first idea was to create a for cycle on the psinfo structures in
order to sum all the RSS and VSZ value from the processes in the same
zone... it works but it sums many times the same shared memory parts
(for example it appears as though Oracle is using several times more
memory than what is actually installed on the system).
To properly determine how much memory a process is using, I should
use an API that separates private and shared memory information about
processes running in the local zones.
Does anybody know how I can get Zones' memory usage from the Global
zone? Does it exist an API to collect this information?
Thanks in advance!!!
Take a look at the proc(4) man page; you'll find the xmap interface
to be useful here:
typedef struct prxmap {
uintptr_t pr_vaddr; /* virtual address of mapping */
size_t pr_size; /* size of mapping in bytes */
char pr_mapname[PRMAPSZ]; /* name in /proc/pid/object */
offset_t pr_offset; /* offset into mapped object, if any */
int pr_mflags; /* protection and attribute flags */
int pr_pagesize; /* pagesize for this mapping in bytes */
int pr_shmid; /* SysV shared memory identifier */
dev_t pr_dev; /* device of mapped object, if any */
uint64_t pr_ino; /* inode of mapped object, if any */
size_t pr_rss; /* pages of resident memory */
size_t pr_anon; /* pages of resident anonymous memory */
size_t pr_locked; /* pages of locked memory */
uint64_t pr_hatpagesize; /* pagesize of mapping */
} prxmap_t;
You can use this to correlate mappings between processes.
Try doing this for a simple test process first that creates a
MAP_SHARED segment and then forks & both parent and child
sleep....
- Bart
--
Bart Smaalders Solaris Kernel Performance
ba...@cyber.eng.sun.com http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code