Exemple #1
0
	def run(self):
		changed = False
		if self.dialog.run() == gtk.RESPONSE_OK:
			new_policy = int(self.sched_policy.get_active())
			new_prio = int(self.sched_pri.get_value())
			new_affinity = self.affinity.get_text()
			if self.just_this_thread.get_active():
				changed = gui.thread_set_attributes(self.pid_info,
								    new_policy,
								    new_prio,
								    new_affinity,
								    self.nr_cpus)
			elif self.all_these_threads.get_active():
				if gui.thread_set_attributes(self.pid_info,
							     new_policy, new_prio,
							     new_affinity,
							     self.nr_cpus):
					changed = True
				if self.set_attributes_for_threads(self.pid,
								   new_policy,
								   new_prio,
								   new_affinity):
					changed = True
			else:
				changed = self.set_attributes_for_regex(self.regex_edit.get_text(),
									new_policy,
									new_prio,
									new_affinity)

		self.dialog.destroy()
		return changed
Exemple #2
0
    def run(self):
        changed = False
        if self.dialog.run() == gtk.RESPONSE_OK:
            new_policy = int(self.sched_policy.get_active())
            new_prio = int(self.sched_pri.get_value())
            new_affinity = self.affinity.get_text()
            if self.just_this_thread.get_active():
                changed = gui.thread_set_attributes(self.pid_info, new_policy,
                                                    new_prio, new_affinity,
                                                    self.nr_cpus)
            elif self.all_these_threads.get_active():
                if gui.thread_set_attributes(self.pid_info, new_policy,
                                             new_prio, new_affinity,
                                             self.nr_cpus):
                    changed = True
                if self.set_attributes_for_threads(self.pid, new_policy,
                                                   new_prio, new_affinity):
                    changed = True
            else:
                changed = self.set_attributes_for_regex(
                    self.regex_edit.get_text(), new_policy, new_prio,
                    new_affinity)

        self.dialog.destroy()
        return changed
Exemple #3
0
    def run(self):
        changed = False
        if self.dialog.run() == gtk.RESPONSE_OK:
            new_policy = self.sched_policy.get_active()
            new_prio = int(self.sched_pri.get_value())
            new_affinity = self.affinity.get_text()
            irq_re = tuna.threaded_irq_re(self.irq)
            pids = self.ps.find_by_regex(irq_re)
            if pids:
                if gui.thread_set_attributes(self.ps[pids[0]], new_policy,
                                             new_prio, new_affinity,
                                             self.irqs.nr_cpus):
                    changed = True

            try:
                new_affinity = [int(a) for a in new_affinity.split(",")]
            except:
                try:
                    new_affinity = tuna.cpustring_to_list(new_affinity)
                except:
                    new_affinity = procfs.bitmasklist(new_affinity,
                                                      self.irqs.nr_cpus)

            new_affinity.sort()

            curr_affinity = self.irqs[self.irq]["affinity"]
            if curr_affinity != new_affinity:
                tuna.set_irq_affinity(
                    self.irq, procfs.hexbitmask(new_affinity,
                                                self.irqs.nr_cpus))
                changed = True

        self.dialog.destroy()
        return changed
Exemple #4
0
    def set_attributes_for_threads(self, pid, new_policy, new_prio,
                                   new_affinity):
        changed = False
        threads = self.ps[pid]["threads"]
        for tid in threads.keys():
            if gui.thread_set_attributes(threads[tid], new_policy, new_prio,
                                         new_affinity, self.nr_cpus):
                changed = True

        return changed
Exemple #5
0
    def set_attributes_for_regex(self, regex, new_policy, new_prio,
                                 new_affinity):
        changed = False
        cmdline_regex = re.compile(regex)
        for match_pid in self.ps.find_by_cmdline_regex(cmdline_regex):
            if gui.thread_set_attributes(self.ps[match_pid], new_policy,
                                         new_prio, new_affinity, self.nr_cpus):
                changed = True

        return changed
Exemple #6
0
	def set_attributes_for_threads(self, pid, new_policy, new_prio, new_affinity):
		changed = False
		threads = self.ps[pid]["threads"]
		for tid in threads.keys():
			if gui.thread_set_attributes(threads[tid], new_policy,
						     new_prio, new_affinity,
						     self.nr_cpus):
				changed = True

		return changed
Exemple #7
0
	def set_attributes_for_regex(self, regex, new_policy, new_prio, new_affinity):
		changed = False
		cmdline_regex = re.compile(regex)
		for match_pid in self.ps.find_by_cmdline_regex(cmdline_regex):
			if gui.thread_set_attributes(self.ps[match_pid],
						     new_policy, new_prio,
						     new_affinity,
						     self.nr_cpus):
				changed = True

		return changed
Exemple #8
0
	def run(self):
		changed = False
		if self.dialog.run() == gtk.RESPONSE_OK:
			new_policy = self.sched_policy.get_active()
			new_prio = int(self.sched_pri.get_value())
			new_affinity = self.affinity.get_text()
			irq_re = tuna.threaded_irq_re(self.irq)
			pids = self.ps.find_by_regex(irq_re)
			if pids:
				if gui.thread_set_attributes(self.ps[pids[0]],
							     new_policy,
							     new_prio,
							     new_affinity,
							     self.irqs.nr_cpus):
					changed = True

			try:
				new_affinity = [ int(a) for a in new_affinity.split(",") ]
			except:
				try:
					new_affinity = tuna.cpustring_to_list(new_affinity)
				except:
					new_affinity = procfs.bitmasklist(new_affinity,
									  self.irqs.nr_cpus)

			new_affinity.sort()

			curr_affinity = self.irqs[self.irq]["affinity"]
			if curr_affinity != new_affinity:
				tuna.set_irq_affinity(self.irq,
						      procfs.hexbitmask(new_affinity,
									self.irqs.nr_cpus))
				changed = True

		self.dialog.destroy()
		return changed