By Jeff Victor-Oracle on Nov 24, 2008
It's - already - time for a zonestat update. I was never happy with the method that zonestat used to discover the mappings of zones to resource pools, but wanted to get v1.1 "out the door" before I had a chance to improve on its use of zonecfg(1M). The obvious problem, which at least one person stumbled over, was the fact that you can re-configure a zone while it's running. After doing that, the configuration information doesn't match the current mapping of zone to pool, and zonestat became confused.
Anyway, I found the time to replace the code in zonestat which discovered zone-to-pool mappings with a more sophisticated method. The new method uses ps(1) to learn the PID that each zone's [z]sched process is. Then it uses "poolbind -q <PID>" to look up the pool for that process. The result is more accurate data, but the ps command does use more CPU cycles.
While performing surgery on zonestat, I also:
- began using the kstat module for Perl, reducing CPU time consumed by zonestat
- fixed some bugs in CPU reporting
- limited zonename output to 8 characters to improve readability
- made some small performance improvements
- added a $DEBUG variable which can be used to watch the commands that zonestat is using