def get(self, item): path = self.get_file(item) value = self.target.read_value(path) try: return integer(value) except (TypeError, ValueError): return value
def set_num_cores(obj, value, core): cpus = resolve_cpus(core, obj.target) max_cores = len(cpus) value = integer(value) if value > max_cores: msg = 'Cannot set number of {}\'s to {}; max is {}' raise ValueError(msg.format(core, value, max_cores)) msg = 'CPU{} Hotplugging already configured' # Set cpus to be enabled for cpu in cpus[:value]: if cpu in obj.num_cores: raise ConfigError(msg.format(cpu)) obj.num_cores[cpu] = True # Set the remaining cpus to be disabled. for cpu in cpus[value:]: if cpu in obj.num_cores: raise ConfigError(msg.format(cpu)) obj.num_cores[cpu] = False
def time(self): return integer(self.get('time'))
def usage(self): return integer(self.get('usage'))
def time(self): return integer(self.get("time"))
def usage(self): return integer(self.get("usage"))