Exemplo n.º 1
0
    def __init__(self, ps, pid, pid_info, nr_cpus, gladefile):
        self.ps = ps
        self.pid = pid
        self.pid_info = pid_info
        self.nr_cpus = nr_cpus
        self.window = gtk.glade.XML(gladefile, "set_process_attributes",
                                    "tuna")
        self.dialog = self.window.get_widget("set_process_attributes")
        pixbuf = self.dialog.render_icon(gtk.STOCK_PREFERENCES,
                                         gtk.ICON_SIZE_SMALL_TOOLBAR)
        self.dialog.set_icon(pixbuf)
        event_handlers = {
            "on_cmdline_regex_changed": self.on_cmdline_regex_changed,
            "on_affinity_text_changed": self.on_affinity_text_changed,
            "on_sched_policy_combo_changed":
            self.on_sched_policy_combo_changed,
            "on_command_regex_clicked": self.on_command_regex_clicked,
            "on_all_these_threads_clicked": self.on_all_these_threads_clicked,
            "on_just_this_thread_clicked": self.on_just_this_thread_clicked
        }
        self.window.signal_autoconnect(event_handlers)

        self.sched_pri = self.window.get_widget("sched_pri_spin")
        self.sched_policy = self.window.get_widget("sched_policy_combo")
        self.regex_edit = self.window.get_widget("cmdline_regex")
        self.affinity = self.window.get_widget("affinity_text")
        self.just_this_thread = self.window.get_widget("just_this_thread")
        self.all_these_threads = self.window.get_widget("all_these_threads")
        processes = self.window.get_widget("matching_process_list")

        self.sched_pri.set_value(int(pid_info["stat"]["rt_priority"]))
        cmdline_regex = procfs.process_cmdline(pid_info)
        self.affinity_text = tuna.list_to_cpustring(
            schedutils.get_affinity(pid))
        self.affinity.set_text(self.affinity_text)
        self.create_matching_process_model(processes)
        self.create_policy_model(self.sched_policy)
        self.sched_policy.set_active(schedutils.get_scheduler(pid))
        self.regex_edit.set_text(cmdline_regex)
        self.just_this_thread.set_active(True)
        self.regex_edit.set_sensitive(False)
        if not ps.has_key(pid) or not ps[pid].has_key("threads"):
            self.all_these_threads.hide()
        self.on_just_this_thread_clicked(None)
Exemplo n.º 2
0
	def set_thread_columns(self, iter, tid, thread_info):
		new_value = [ None ] * self.nr_columns

		new_value[self.COL_PRI] = int(thread_info["stat"]["rt_priority"])
		new_value[self.COL_POL] = schedutils.schedstr(schedutils.get_scheduler(tid))[6:]
		thread_affinity_list = schedutils.get_affinity(tid)

		new_value[self.COL_PID] = tid
		new_value[self.COL_AFF] = tuna.list_to_cpustring(thread_affinity_list)
		try:
			new_value[self.COL_VOLCTXT] = int(thread_info["status"]["voluntary_ctxt_switches"])
			new_value[self.COL_NONVOLCTXT] = int(thread_info["status"]["nonvoluntary_ctxt_switches"])
			new_value[self.COL_CGROUP] = thread_info["cgroups"]
		except:
			pass

		new_value[self.COL_CMDLINE] = procfs.process_cmdline(thread_info)

		gui.set_store_columns(self.tree_store, iter, new_value)
Exemplo n.º 3
0
    def set_thread_columns(self, iter, tid, thread_info):
        new_value = [None] * self.nr_columns

        new_value[self.COL_PRI] = int(thread_info["stat"]["rt_priority"])
        new_value[self.COL_POL] = schedutils.schedstr(
            schedutils.get_scheduler(tid))[6:]
        thread_affinity_list = schedutils.get_affinity(tid)

        new_value[self.COL_PID] = tid
        new_value[self.COL_AFF] = tuna.list_to_cpustring(thread_affinity_list)
        try:
            new_value[self.COL_VOLCTXT] = int(
                thread_info["status"]["voluntary_ctxt_switches"])
            new_value[self.COL_NONVOLCTXT] = int(
                thread_info["status"]["nonvoluntary_ctxt_switches"])
            new_value[self.COL_CGROUP] = thread_info["cgroups"]
        except:
            pass

        new_value[self.COL_CMDLINE] = procfs.process_cmdline(thread_info)

        gui.set_store_columns(self.tree_store, iter, new_value)
Exemplo n.º 4
0
	def __init__(self, ps, pid, pid_info, nr_cpus, gladefile):
		self.ps = ps
		self.pid = pid
		self.pid_info = pid_info
		self.nr_cpus = nr_cpus
		self.window = gtk.glade.XML(gladefile, "set_process_attributes", "tuna")
		self.dialog = self.window.get_widget("set_process_attributes")
		pixbuf = self.dialog.render_icon(gtk.STOCK_PREFERENCES,
						 gtk.ICON_SIZE_SMALL_TOOLBAR)
		self.dialog.set_icon(pixbuf)
		event_handlers = { "on_cmdline_regex_changed" : self.on_cmdline_regex_changed,
				   "on_affinity_text_changed" : self.on_affinity_text_changed,
				   "on_sched_policy_combo_changed" : self.on_sched_policy_combo_changed,
				   "on_command_regex_clicked" : self.on_command_regex_clicked,
				   "on_all_these_threads_clicked" : self.on_all_these_threads_clicked,
				   "on_just_this_thread_clicked" : self.on_just_this_thread_clicked }
		self.window.signal_autoconnect(event_handlers)

		self.sched_pri = self.window.get_widget("sched_pri_spin")
		self.sched_policy = self.window.get_widget("sched_policy_combo")
		self.regex_edit = self.window.get_widget("cmdline_regex")
		self.affinity = self.window.get_widget("affinity_text")
		self.just_this_thread = self.window.get_widget("just_this_thread")
		self.all_these_threads = self.window.get_widget("all_these_threads")
		processes = self.window.get_widget("matching_process_list")

		self.sched_pri.set_value(int(pid_info["stat"]["rt_priority"]))
		cmdline_regex = procfs.process_cmdline(pid_info)
		self.affinity_text = tuna.list_to_cpustring(schedutils.get_affinity(pid))
		self.affinity.set_text(self.affinity_text)
		self.create_matching_process_model(processes)
		self.create_policy_model(self.sched_policy)
		self.sched_policy.set_active(schedutils.get_scheduler(pid))
		self.regex_edit.set_text(cmdline_regex)
		self.just_this_thread.set_active(True)
		self.regex_edit.set_sensitive(False)
		if not ps.has_key(pid) or not ps[pid].has_key("threads"):
			self.all_these_threads.hide()
		self.on_just_this_thread_clicked(None)