> Hey, > > Im on S10 GA and I am trying to figure out why when I fire ::memstat it takes > 7 seconds or so to execute. The mdb's CPU consumption goes around 30% > reported by prstat during this period. > > Is it ok for ::memstat to execute in a 6, 7 seconds ? My machine is: > > Thinkapd T23 > Pentium III, 1GB RAM
memstat isn't showing precomputed statistics (e.g. equivalent of a kstat we have stashed somewhere): the implementation of that dcmd is quite literally to iterate over every page_t in the system (1GB / 4k = 262144 minus a few for things that aren't in the kernel) and for each one examine its properties and compute the results. Then, since you're looking at the live kernel, the act of reading so much of /dev/kmem is a pretty heavy-weight operation in that for each page we have to create new mappings and then tear them down. If you wanted to drill down here you could use DTrace to measure the time per-page of doing each step of the "page" walker. As part of the VM system reworking that is going on, it might be useful to think about having the kernel keep these things all the time and then we could modify the dcmd to simply read the cached values. Rich McDougall and George Cameron would be the people to talk to about that. -Mike -- Mike Shapiro, Solaris Kernel Development.