Skip to content

Instantly share code, notes, and snippets.

@fcicq
Created August 12, 2012 13:16
Show Gist options
  • Select an option

  • Save fcicq/3331771 to your computer and use it in GitHub Desktop.

Select an option

Save fcicq/3331771 to your computer and use it in GitHub Desktop.
Virtualization Env friendly dstat
Virtualization env friendly dstat, hiq + siq -> int, added steal by fcicq
Usage:
cd /usr/bin; sudo patch -p0 < /path/xxx.diff
--- /usr/bin/dstat 2010-06-11 14:08:01.000000000 +0800
+++ /usr/bin/dstat.new 2012-08-12 21:06:56.000000000 +0800
@@ -561,7 +561,7 @@
class dstat_cpu(dstat):
def __init__(self):
- self.nick = ( 'usr', 'sys', 'idl', 'wai', 'hiq', 'siq' )
+ self.nick = ( 'usr', 'sys', 'idl', 'wai', 'int', 'ste' )
self.type = 'p'
self.width = 3
self.scale = 34
@@ -609,7 +609,7 @@
if len(l) < 8: continue
for name in self.vars:
if l[0] == 'cpu' + name or ( l[0] == 'cpu' and name == 'total' ):
- self.set2[name] = ( long(l[1]) + long(l[2]), long(l[3]), long(l[4]), long(l[5]), long(l[6]), long(l[7]) )
+ self.set2[name] = ( long(l[1]) + long(l[2]), long(l[3]), long(l[4]), long(l[5]), long(l[6]) + long(l[7]), long(l[8]) )
for name in self.vars:
for i in range(6):
if sum(self.set2[name]) > sum(self.set1[name]):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment