def append_new_tids(self, parent_row, threads, tid_list): for tid in tid_list: if tuna.thread_filtered(tid, self.cpus_filtered, self.show_kthreads, self.show_uthreads): continue row = self.tree_store.append(parent_row) try: self.set_thread_columns(row, tid, threads[tid]) except: # Thread doesn't exists anymore self.tree_store.remove(row) continue if threads[tid].has_key("threads"): children = threads[tid]["threads"] children_list = children.keys() children_list.sort() for child in children_list: child_row = self.tree_store.append(row) try: self.set_thread_columns(child_row, child, children[child]) except: # Thread doesn't exists anymore self.tree_store.remove(child_row)
def update_rows(self, threads, row, parent_row): new_tids = threads.keys() previous_row = None while row: tid = self.tree_store.get_value(row, self.COL_PID) if previous_row: previous_tid = self.tree_store.get_value( previous_row, self.COL_PID) if previous_tid == tid: # print "WARNING: tree_store dup %d, fixing..." % tid self.tree_store.remove(previous_row) if not threads.has_key(tid): if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break else: try: new_tids.remove(tid) except: # FIXME: understand in what situation this # can happen, seems harmless from visual # inspection. pass if tuna.thread_filtered(tid, self.cpus_filtered, self.show_kthreads, self.show_uthreads): if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break else: try: self.set_thread_columns(row, tid, threads[tid]) if threads[tid].has_key("threads"): children = threads[tid]["threads"] else: children = {} child_row = self.tree_store.iter_children(row) self.update_rows(children, child_row, row) except: # thread doesn't exists anymore if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break previous_row = row row = self.tree_store.iter_next(row) new_tids.sort() self.append_new_tids(parent_row, threads, new_tids)
def update_rows(self, threads, row, parent_row): new_tids = threads.keys() previous_row = None while row: tid = self.tree_store.get_value(row, self.COL_PID) if previous_row: previous_tid = self.tree_store.get_value(previous_row, self.COL_PID) if previous_tid == tid: # print "WARNING: tree_store dup %d, fixing..." % tid self.tree_store.remove(previous_row) if not threads.has_key(tid): if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break else: try: new_tids.remove(tid) except: # FIXME: understand in what situation this # can happen, seems harmless from visual # inspection. pass if tuna.thread_filtered(tid, self.cpus_filtered, self.show_kthreads, self.show_uthreads): if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break else: try: self.set_thread_columns(row, tid, threads[tid]) if threads[tid].has_key("threads"): children = threads[tid]["threads"] else: children = {} child_row = self.tree_store.iter_children(row) self.update_rows(children, child_row, row) except: # thread doesn't exists anymore if self.tree_store.remove(row): # removed and now row is the next one continue # removed and its the last one break previous_row = row row = self.tree_store.iter_next(row) new_tids.sort() self.append_new_tids(parent_row, threads, new_tids)