コード例 #1
0
ファイル: irqview.py プロジェクト: noushi/tuna
    def __init__(self, treeview, irqs, ps, cpus_filtered, gladefile):

        self.is_root = os.getuid() == 0
        self.irqs = irqs
        self.ps = ps
        self.treeview = treeview
        self.gladefile = gladefile
        self.has_threaded_irqs = tuna.has_threaded_irqs(ps)
        if not self.has_threaded_irqs:
            self.nr_columns = 4
            (self.COL_NUM, self.COL_AFF, self.COL_EVENTS,
             self.COL_USERS) = range(self.nr_columns)
            self.columns = (gui.list_store_column(_("IRQ")),
                            gui.list_store_column(_("Affinity"),
                                                  gobject.TYPE_STRING),
                            gui.list_store_column(_("Events")),
                            gui.list_store_column(_("Users"),
                                                  gobject.TYPE_STRING))

        self.list_store = gtk.ListStore(
            *gui.generate_list_store_columns_with_attr(self.columns))

        # Allow selecting multiple rows
        selection = treeview.get_selection()
        selection.set_mode(gtk.SELECTION_MULTIPLE)

        # Allow enable drag and drop of rows
        self.treeview.enable_model_drag_source(
            gtk.gdk.BUTTON1_MASK, gui.DND_TARGETS,
            gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
        self.treeview.connect("drag_data_get", self.on_drag_data_get_data)
        self.renderer = gtk.CellRendererText()

        for col in range(self.nr_columns):
            column = gtk.TreeViewColumn(self.columns[col].name,
                                        self.renderer,
                                        text=col)
            column.set_sort_column_id(col)
            column.add_attribute(self.renderer, "weight",
                                 col + self.nr_columns)
            self.treeview.append_column(column)

        self.cpus_filtered = cpus_filtered
        self.refreshing = True

        self.treeview.set_model(self.list_store)
コード例 #2
0
ファイル: irqview.py プロジェクト: bristot/tuna
	def __init__(self, treeview, irqs, ps, cpus_filtered, gladefile):

		self.is_root = os.getuid() == 0
		self.irqs = irqs
		self.ps = ps
		self.treeview = treeview
		self.gladefile = gladefile
		self.has_threaded_irqs = tuna.has_threaded_irqs(ps)
		if not self.has_threaded_irqs:
			self.nr_columns = 4
			( self.COL_NUM,
			  self.COL_AFF,
			  self.COL_EVENTS,
			  self.COL_USERS ) = range(self.nr_columns)
			self.columns = (gui.list_store_column(_("IRQ")),
					gui.list_store_column(_("Affinity"), gobject.TYPE_STRING),
					gui.list_store_column(_("Events")),
					gui.list_store_column(_("Users"), gobject.TYPE_STRING))

		self.list_store = gtk.ListStore(*gui.generate_list_store_columns_with_attr(self.columns))

		# Allow selecting multiple rows
		selection = treeview.get_selection()
		selection.set_mode(gtk.SELECTION_MULTIPLE)

		# Allow enable drag and drop of rows
		self.treeview.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
						       gui.DND_TARGETS,
						       gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
		self.treeview.connect("drag_data_get", self.on_drag_data_get_data)
		self.renderer = gtk.CellRendererText()

		for col in range(self.nr_columns):
			column = gtk.TreeViewColumn(self.columns[col].name,
						    self.renderer, text = col)
			column.set_sort_column_id(col)
			column.add_attribute(self.renderer, "weight",
					     col + self.nr_columns)
			self.treeview.append_column(column)

		self.cpus_filtered = cpus_filtered
		self.refreshing = True

		self.treeview.set_model(self.list_store)
コード例 #3
0
ファイル: tuna-cmd.py プロジェクト: noushi/tuna
		elif o in ("-K", "--no_kthreads"):
			kthreads = False
		elif o in ("-q", "--irqs"):
			(op, a) = pick_op(a)
			op_list = reduce(lambda i, j: i + j,
					 map(irq_mapper, list(set(a.split(",")))))
			irq_list = do_list_op(op, irq_list, op_list)
			# See comment above about thread_list_str
			if not op_list and type(a) == type(''):
				irq_list_str = do_list_op(op, irq_list_str,
							  a.split(","))
			if not op:
				thread_list = []
			if not ps:
				ps = procfs.pidstats()
			if tuna.has_threaded_irqs(ps):
				for irq in irq_list:
					irq_re = tuna.threaded_irq_re(irq)
					irq_threads = ps.find_by_regex(irq_re)
					if irq_threads:
						# Change the affinity of the thread too
						# as we can't rely on changing the irq
						# affinity changing the affinity of the
						# thread or vice versa. We need to change
						# both.
						thread_list += irq_threads

		elif o in ("-U", "--no_uthreads"):
			uthreads = False
		elif o in ("-v", "--version"):
			print version
コード例 #4
0
ファイル: tuna-cmd.py プロジェクト: noushi/tuna
                op_list += [int(cpu.name[3:]) for cpu in cpu_info.sockets[socket]]
            cpu_list = do_list_op(op, cpu_list, op_list)
        elif o in ("-K", "--no_kthreads"):
            kthreads = False
        elif o in ("-q", "--irqs"):
            (op, a) = pick_op(a)
            op_list = reduce(lambda i, j: i + j, map(irq_mapper, list(set(a.split(",")))))
            irq_list = do_list_op(op, irq_list, op_list)
            # See comment above about thread_list_str
            if not op_list and type(a) == type(""):
                irq_list_str = do_list_op(op, irq_list_str, a.split(","))
            if not op:
                thread_list = []
            if not ps:
                ps = procfs.pidstats()
            if tuna.has_threaded_irqs(ps):
                for irq in irq_list:
                    irq_re = tuna.threaded_irq_re(irq)
                    irq_threads = ps.find_by_regex(irq_re)
                    if irq_threads:
                        # Change the affinity of the thread too
                        # as we can't rely on changing the irq
                        # affinity changing the affinity of the
                        # thread or vice versa. We need to change
                        # both.
                        thread_list += irq_threads

        elif o in ("-U", "--no_uthreads"):
            uthreads = False
        elif o in ("-v", "--version"):
            print version