diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-01-08 10:48:18 -0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-01-08 10:48:18 -0200 |
commit | 407315b3f248da39efa5013e9ec90c7c5616999a (patch) | |
tree | ddd58e7c04d72776df4cfe439a8d73fdcb8e96c2 | |
parent | 7e7076f440c0016e6a0f403ee6f73f0f2576a27b (diff) | |
download | tuna-407315b3f248da39efa5013e9ec90c7c5616999a.tar.gz |
gui: Stop handling exceptions at procview.set_thread_columns
We have more coverage if we do it in the callers, as we should have been
also handling thread_info["stat"] calls, for instance, that may be only
at this point parsing /proc/<PID>/stat.
Also its too C-ish to handle errors with return values, python has
exceptions dammit. :-)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tuna/tuna_gui.py | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py index de3b5cc..9dcec13 100644 --- a/tuna/tuna_gui.py +++ b/tuna/tuna_gui.py @@ -1082,12 +1082,8 @@ class procview: new_value = [ None ] * self.nr_columns new_value[self.COL_PRI] = int(thread_info["stat"]["rt_priority"]) - - try: - new_value[self.COL_POL] = schedutils.schedstr(schedutils.get_scheduler(tid))[6:] - thread_affinity_list = schedutils.get_affinity(tid) - except SystemError: - return True + 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) @@ -1101,8 +1097,6 @@ class procview: set_store_columns(self.tree_store, iter, new_value) - return False - def show(self, force_refresh = False): # Start with the first row, if there is one, on the # process list. If the first time update_rows will just @@ -1147,15 +1141,22 @@ class procview: # removed and its the last one break else: - 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) + 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) @@ -1172,8 +1173,9 @@ class procview: row = self.tree_store.append(parent_row) - if self.set_thread_columns(row, tid, threads[tid]): - # Thread doesn't exists anymore + try: + self.set_thread_columns(row, tid, threads[tid]) + except: # Thread doesn't exists anymore self.tree_store.remove(row) continue @@ -1183,10 +1185,11 @@ class procview: children_list.sort() for child in children_list: child_row = self.tree_store.append(row) - if self.set_thread_columns(child_row, - child, - children[child]): - # Thread doesn't exists anymore + try: + self.set_thread_columns(child_row, + child, + children[child]) + except: # Thread doesn't exists anymore self.tree_store.remove(child_row) def refresh(self): |