Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/libvirt/kvm_cpu | ||
|---|---|---|
| 70 | 70 |
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
| 71 | 71 |
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_-]*)\x00\-.*$",r"\1", cmdline.readline())) |
| 72 | 72 |
return result |
| 73 |
|
|
| 73 |
|
|
| 74 | 74 |
def list_pids(): |
| 75 | 75 |
''' Find the pid of kvm processes |
| 76 | 76 |
@return a list of pids from running kvm |
| ... | ... | |
| 85 | 85 |
for ( pid, name ) in vms.iteritems(): |
| 86 | 86 |
( user, system ) = open("/proc/%s/stat" % pid, 'r').readline().split(' ')[13:15]
|
| 87 | 87 |
print '%s_cpu.value %d' % ( name, int(user) + int(system) ) |
| 88 |
|
|
| 88 |
|
|
| 89 | 89 |
if __name__ == "__main__": |
| 90 | 90 |
if len(sys.argv) > 1: |
| 91 | 91 |
if sys.argv[1] in ['autoconf', 'detect']: |
Formats disponibles : Unified diff