Ejemplo n.º 1
0
 def cpu_affinity_set(self, cpus):
     try:
         cext.proc_cpu_affinity_set(self.pid, cpus)
     except OSError as err:
         if err.errno == errno.EINVAL:
             allcpus = tuple(range(len(per_cpu_times())))
             for cpu in cpus:
                 if cpu not in allcpus:
                     raise ValueError("invalid CPU #%i (choose between %s)"
                                      % (cpu, allcpus))
         raise
Ejemplo n.º 2
0
 def cpu_affinity_set(self, cpus):
     try:
         cext.proc_cpu_affinity_set(self.pid, cpus)
     except OSError as err:
         if err.errno == errno.EINVAL:
             allcpus = tuple(range(len(per_cpu_times())))
             for cpu in cpus:
                 if cpu not in allcpus:
                     raise ValueError(
                         "invalid CPU #%i (choose between %s)" %
                         (cpu, allcpus))
         raise