mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +00:00 
			
		
		
		
	Merge pull request #124 from bjackman/cpufreq-iter-domains
Add iter_domains method to cpufreq module
This commit is contained in:
		@@ -421,3 +421,14 @@ class CpufreqModule(Module):
 | 
				
			|||||||
        sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu)
 | 
					        sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return [int(c) for c in self.target.read_value(sysfile).split()]
 | 
					        return [int(c) for c in self.target.read_value(sysfile).split()]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def iter_domains(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Iterate over the frequency domains in the system
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        cpus = set(range(self.target.number_of_cpus))
 | 
				
			||||||
 | 
					        while cpus:
 | 
				
			||||||
 | 
					            cpu = iter(cpus).next()
 | 
				
			||||||
 | 
					            domain = self.target.cpufreq.get_domain_cpus(cpu)
 | 
				
			||||||
 | 
					            yield domain
 | 
				
			||||||
 | 
					            cpus = cpus.difference(domain)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user