def parse(writer, paths, prune, crop_after, annotate): state = parse_paths(writer, ParserState(), paths) if not state.valid(): raise ParseError( "empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) # Crop the chart to the end of the first idle period after the given # process if crop_after: idle = crop(writer, crop_after, state) else: idle = None # Annotate other times as the first start point of given process lists times = [idle] if annotate: for procnames in annotate: names = [x[:15] for x in procnames.split(",")] for proc in state.ps_stats.process_list: if proc.cmd in names: times.append(proc.start_time) break else: times.append(None) monitored_app = state.headers.get("profile.process") proc_tree = ProcessTree(writer, state.ps_stats, monitored_app, prune, idle) return (state.headers, state.cpu_stats, state.disk_stats, proc_tree, times)
def __init__(self): super().__init__(title="Task manager") self.connection = None self.set_position(Gtk.WindowPosition.CENTER) self.set_size_request(1000, 500) master_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.add(master_box) hpaned = Gtk.Paned() master_box.add(hpaned) left_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) app_header = Gtk.Label(label='APPLICATIONS') self.proc_header = Gtk.Label(label='PROCESSES') left_box.pack_start(app_header, False, True, 0) right_box.pack_start(self.proc_header, False, True, 0) hpaned.add1(left_box) hpaned.add2(right_box) applications_tree_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.applications_treeview = ApplicationTree() app_adj = Gtk.Adjustment() applications_scroll = Gtk.ScrolledWindow(app_adj) applications_scroll.set_size_request(400, 500) applications_scroll.add_with_viewport(self.applications_treeview) left_box.pack_start(applications_tree_box, False, True, 0) applications_tree_box.pack_start(applications_scroll, True, True, 0) proc_adj = Gtk.Adjustment() process_tree_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) right_box.pack_start(process_tree_box, False, True, 0) self.process_scroll = Gtk.ScrolledWindow(proc_adj) self.process_scroll.set_size_request(600, 220) process_tree_box.pack_start(self.process_scroll, True, True, 0) self.process_treeview = ProcessTree() self.process_scroll.add_with_viewport(self.process_treeview) button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) right_box.pack_end(button_box, False, True, 0) close_button = Gtk.Button(label="Close") close_button.connect("clicked", self.close_app) button_box.pack_start(close_button, True, True, 0) # self.freeze_button = FreezeButton() # self.freeze_button.connect('clicked', self.freeze) # button_box.pack_start(self.freeze_button, True, True, 0) self.proc_kill_button = ProcessKillButton() self.proc_kill_button.connect("clicked", self.kill_process) button_box.pack_start(self.proc_kill_button, True, True, 0) self.process_info_label = Gtk.Label() self.process_info_label.set_size_request(430, 210) self.process_info_label.set_selectable(True) self.process_info_label.set_line_wrap(True) self.info_header = Gtk.Label(label='DETAILED PROCESS INFO') right_box.pack_start(self.info_header, True, True, 0) keys_scrolled = Gtk.ScrolledWindow() self.keys_tree = InfoTree(1) keys_scrolled.add(self.keys_tree) info_scrolled = Gtk.ScrolledWindow() info_scrolled.set_size_request(430, 210) info_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) info_box.set_size_request(430, 210) info_box.pack_start(keys_scrolled, True, True, 0) info_box.pack_start(info_scrolled, True, True, 0) info_scrolled.add(self.process_info_label) right_box.add(info_box) self.process_select = self.process_treeview.get_selection() self.process_select.connect("changed", self.selection_changed) self.param_select = self.keys_tree.get_selection() self.param_select.connect("changed", self.selection_changed) self.app_select = self.applications_treeview.get_selection() self.app_select.connect("changed", self.app_selection_changed) self.applications_treeview.selected_app = '/(ALL)' self.closing = False def proc_tree_update(): if self.closing: return False self.process_treeview.fill_store( self.applications_treeview.selected_app ) proc_adj.set_value(0) return True def app_tree_update(): if self.closing: return False self.applications_treeview.fill_store() app_adj.set_value(0) return True GLib.timeout_add_seconds(1, proc_tree_update) GLib.timeout_add_seconds(1, app_tree_update)
def __init__(self, drivingEngine, exp): self.drivingEngine = drivingEngine self.tree = ProcessTree(exp)