Specifications
Administration Guide
342 VMware, Inc.
Examples
Suppose!that!we!are!interested!in!the!CPU!allocation!for!the!virtual!machine!with!ID!
103.!To!query!the!number!of!shares!allocated!to!virtual!machine!103,!read!the!file.
cat /proc/vmware/vm/103/cpu/shares
The!number!of!shares!is!displayed.
1000
This!indicates!that!virtual!machine!103!is!currently!allocated!1,000!shares.!To!change!the!
number!of!shares!allocated!to!virtual!machine!103,!simply!write!to!the!file.!Note!that!
you!need!root!privileges!to!change!share!allocations.
echo 2000 > /proc/vmware/vm/103/cpu/shares
You!can!also!write!to!the!file!by!specifying!low,!normal,!or!high.!ESX!Server!writes!the!
numerical!value!for!these!special!values.
echo high > /proc/vmware/vm/103/cpu/shares
The!change!can!be!confirmed!by!reading!the!file!again.
cat /proc/vmware/vm/103/cpu/shares
The!number!of!shares!is!displayed.
2000
To!query!the!affinity!set!for!virtual!machine!103,!read!the!file:!
cat /proc/vmware/vm/103/cpu/affinity
The!identifying!numbers!of!the!processors!in!the!affinity!set!are!displayed.
0,1
This!indicates!that!virtual!machine!103!is!allowed!to!run!on!CPUs!0!and!1.!To!restrict!
virtual!machine!103!to!run!only!on!CPU!1,!write!to!the!file.!You!need!root!privileges!to!
change!affinity!sets.!
echo 1 > /proc/vmware/vm/103/cpu/affinity
The!change!can!be!confirmed!by!reading!the!file!again.!
Monitoring CPU Statistics
The!VMware!Management!Interface!provides!information!on!the!current!use!of!CPU!
by!the!physical!computer!and!the!virtual!machines!running!on!it.!View!the!Status!
Monitor!tab!in!the!management!interface.!See!Figure 12‐1.
N
OTE The!affinity!set!must!contain!at!least!as!many!CPUs!as!virtual!CPUs;!that!is,!1!CPU!for!
a!uniprocessor!(UP)!virtual!machine!and!2!CPU!for!a!SMP!virtual!machine.