def vm_cputime(vm_=None):
 host_cpus = __get_conn().getInfo()[2]
 def _info(vm_):
  dom = _get_domain(vm_)
  raw = dom.info()
  vcpus = int(raw[3])
  cputime = int(raw[4])
  cputime_percent = 0
  if cputime:
   cputime_percent = (((1e-07 * cputime) / host_cpus) / vcpus)
  return {'cputime': int(raw[4]), 'cputime_percent': int('{0:.0f}'.format(cputime_percent))}
 info = {}
 if vm_:
  info[vm_] = _info(vm_)
 else:
  for vm_ in list_domains():
   info[vm_] = _info(vm_)
 return info

def vm_cputime ( vm_ = None ) : host_cpus = __get_conn ( ) . getInfo ( ) [ 2 ] def _info ( vm_ ) : dom = _get_domain ( vm_ ) raw = dom . info ( ) vcpus = int ( raw [ 3 ] ) cputime = int ( raw [ 4 ] ) cputime_percent = 0 if cputime : cputime_percent = ( ( ( 1e-07 * cputime ) / host_cpus ) / vcpus ) return { 'cputime' : int ( raw [ 4 ] ) , 'cputime_percent' : int ( '{0:.0f}' . format ( cputime_percent ) ) } info = { } if vm_ : info [ vm_ ] = _info ( vm_ ) else : for vm_ in list_domains ( ) : info [ vm_ ] = _info ( vm_ ) return info
return cputime used by the vms on this hyper in a list of dicts: .