Logo Search packages:      
Sourcecode: guidance-power-manager version File versions

def powermanage::PowerManage::_checkCpuCapabilities (   self  )  [private]

Find out the number of CPUs / cores, check which governors are avaible.

Definition at line 344 of file powermanage.py.

00344                                    :
        """ Find out the number of CPUs / cores, check which governors are avaible."""
        cpufreq_dir = "/sys/devices/system/cpu"
        self.cpus = []
        for cpu in os.listdir(cpufreq_dir):
            if cpu.startswith('cpu') and cpu != 'cpuidle':
                self.cpus.append(cpu)
        self.cpus.sort()

        # Map our policies to cpufreq governors.
        self.cpu_policy = {}
        self.cpu_policy['dynamic/ac'] = []
        self.cpu_policy['dynamic/battery'] = []
        self.cpu_policy['powersave'] = []
        self.cpu_policy['performance'] = []

        try:
            comp_obj = self.bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer')
            self.cpufreq = dbus.Interface(comp_obj, 'org.freedesktop.Hal.Device.CPUFreq')
            self.governor_available = self.cpufreq.GetCPUFreqAvailableGovernors()
        except dbus.DBusException:
            return
        self.hasCpuFreqGovernors = True

        if 'ondemand' in self.governor_available:
            self.cpu_policy['dynamic/ac'].append('ondemand') 
            self.cpu_policy['dynamic/battery'].append('ondemand') 
        if 'conservative' in self.governor_available:
            self.cpu_policy['dynamic/ac'].append('conservative') 
            self.cpu_policy['dynamic/battery'].insert(0,'conservative') 
        if 'userspace' in self.governor_available:
            self.cpu_policy['dynamic/ac'].append('userspace') 
            self.cpu_policy['dynamic/battery'].append('userspace') 
        if 'powersave' in self.governor_available:
            self.cpu_policy['powersave'].append('powersave') 
        if 'performance' in self.governor_available:
            self.cpu_policy['performance'].append('performance') 

    def getSupportedCpuPolicies(self):


Generated by  Doxygen 1.6.0   Back to index