Пример #1
0
 def get(self, item):
     path = self.get_file(item)
     value = self.target.read_value(path)
     try:
         return  integer(value)
     except (TypeError, ValueError):
         return value
Пример #2
0
    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
Пример #3
0
 def time(self):
     return integer(self.get('time'))
Пример #4
0
 def usage(self):
     return integer(self.get('usage'))
Пример #5
0
 def time(self):
     return integer(self.get('time'))
Пример #6
0
 def usage(self):
     return integer(self.get('usage'))
Пример #7
0
 def time(self):
     return integer(self.get("time"))
Пример #8
0
 def usage(self):
     return integer(self.get("usage"))