Example #1
0
def ps_show(
    ps,
    affect_children,
    thread_list,
    cpu_list,
    irq_list_numbers,
    show_uthreads,
    show_kthreads,
    has_ctxt_switch_info,
    sock_inodes,
    sock_inode_re,
    cgroups,
):

    ps_list = []
    for pid in ps.keys():
        iskth = tuna.iskthread(pid)
        if not show_uthreads and not iskth:
            continue
        if not show_kthreads and iskth:
            continue
        in_irq_list = False
        if irq_list_numbers:
            if tuna.is_hardirq_handler(ps, pid):
                try:
                    irq = int(ps[pid]["stat"]["comm"][4:])
                    if irq not in irq_list_numbers:
                        if not thread_list:
                            continue
                    else:
                        in_irq_list = True
                except:
                    pass
            elif not thread_list:
                continue
        if not in_irq_list and thread_list and pid not in thread_list:
            continue
        try:
            affinity = schedutils.get_affinity(pid)
        except (
            SystemError,
            OSError,
        ) as e:  # (3, 'No such process') old python-schedutils incorrectly raised SystemError
            if e[0] == 3:
                continue
            raise e
        if cpu_list and not set(cpu_list).intersection(set(affinity)):
            continue
        ps_list.append(pid)

    ps_list.sort()

    for pid in ps_list:
        ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info, sock_inodes, sock_inode_re, cgroups)
Example #2
0
    def ps_show(self, ps, affect_children, thread_list, cpu_list,
                irq_list_numbers, show_uthreads, show_kthreads,
                has_ctxt_switch_info, sock_inodes, sock_inode_re, cgroups):

        ps_list = []
        for pid in ps.keys():
            iskth = tuna.iskthread(pid)
            if not show_uthreads and not iskth:
                continue
            if not show_kthreads and iskth:
                continue
            in_irq_list = False
            if irq_list_numbers:
                if tuna.is_hardirq_handler(ps, pid):
                    try:
                        irq = int(ps[pid]["stat"]["comm"][4:])
                        if irq not in irq_list_numbers:
                            if not thread_list:
                                continue
                        else:
                            in_irq_list = True
                    except:
                        pass
                elif not thread_list:
                    continue
            if not in_irq_list and thread_list and pid not in thread_list:
                continue
            try:
                affinity = schedutils.get_affinity(pid)
            except (
                    SystemError, OSError
            ) as e:  # (3, 'No such process') old python-schedutils incorrectly raised SystemError
                if e[0] == 3:
                    continue
                raise e
            if cpu_list and not set(cpu_list).intersection(set(affinity)):
                continue
            ps_list.append(pid)

        ps_list.sort()

        for pid in ps_list:
            self.ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info,
                                sock_inodes, sock_inode_re, cgroups)
Example #3
0
	def on_query_tooltip(self, treeview, x, y, keyboard_mode, tooltip):
		x, y = treeview.convert_widget_to_bin_window_coords(x, y)
		ret = treeview.get_path_at_pos(x, y)
		tooltip.set_text(None)
		if not ret:
			return True
		path, col, xpos, ypos = ret
		if not path:
			return True
		col_id = col.get_sort_column_id()
		if col_id != self.COL_CMDLINE:
			return True
		row = self.tree_store.get_iter(path)
		if not row:
			return True
		pid = int(self.tree_store.get_value(row, self.COL_PID))
		if not tuna.iskthread(pid):
			return True
		cmdline = self.tree_store.get_value(row, self.COL_CMDLINE).split(' ')[0]
		help = tuna.kthread_help(cmdline)
		tooltip.set_markup("<b>%s %d(%s)</b>\n%s" % \
			(_("Kernel Thread"), pid, cmdline, _(help)))
		return True
Example #4
0
 def on_query_tooltip(self, treeview, x, y, keyboard_mode, tooltip):
     x, y = treeview.convert_widget_to_bin_window_coords(x, y)
     ret = treeview.get_path_at_pos(x, y)
     tooltip.set_text(None)
     if not ret:
         return True
     path, col, xpos, ypos = ret
     if not path:
         return True
     col_id = col.get_sort_column_id()
     if col_id != self.COL_CMDLINE:
         return True
     row = self.tree_store.get_iter(path)
     if not row:
         return True
     pid = int(self.tree_store.get_value(row, self.COL_PID))
     if not tuna.iskthread(pid):
         return True
     cmdline = self.tree_store.get_value(row,
                                         self.COL_CMDLINE).split(' ')[0]
     help = tuna.kthread_help(cmdline)
     tooltip.set_markup("<b>%s %d(%s)</b>\n%s" % \
      (_("Kernel Thread"), pid, cmdline, _(help)))
     return True