summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2008-11-28 12:18:10 -0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2008-11-28 12:18:10 -0200
commitadc836b2b57357c435418aad3eae79e39122ce2f (patch)
tree0256591dedfc08066f295265b8df146d737f5856
parentf9e8ee8d96666d0717668e5c2f81078979cb1b10 (diff)
downloadtuna-adc836b2b57357c435418aad3eae79e39122ce2f.tar.gz
cmdline: Always set irq_list_numbers to [] in ps_show_thread
So that when we don't pass a irq_list, it doesn't explodes later on: [root@doppio tuna]# tuna -t 1,2 -P thread ctxt_switches pid SCHED_ rtpri affinity voluntary nonvoluntary cmd Traceback (most recent call last): File "./tuna-cmd.py", line 342, in <module> main() File "./tuna-cmd.py", line 272, in main kthreads, affect_children) File "./tuna-cmd.py", line 198, in do_ps has_ctxt_switch_info) File "./tuna-cmd.py", line 162, in ps_show if irq_list_numbers: UnboundLocalError: local variable 'irq_list_numbers' referenced before assignment [root@doppio tuna]# Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xtuna-cmd.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 0c6e571..3d27dd2 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -137,8 +137,8 @@ def ps_show_thread(pid, affect_children, ps, cpuinfo, irqs, nics, has_ctxt_switc
def ps_show(ps, affect_children, cpuinfo, irqs, thread_list, cpu_list,
irq_list, show_uthreads, show_kthreads, has_ctxt_switch_info):
+ irq_list_numbers = []
if irq_list:
- irq_list_numbers = []
for i in irq_list:
try:
irq = int(i)
@@ -160,14 +160,15 @@ def ps_show(ps, affect_children, cpuinfo, irqs, thread_list, cpu_list,
if not show_kthreads and iskth:
continue
if irq_list_numbers:
- if not tuna.is_hardirq_handler(ps, pid):
+ if tuna.is_hardirq_handler(ps, pid):
+ try:
+ irq = int(ps[pid]["stat"]["comm"][4:])
+ if irq not in irq_list_numbers:
+ continue
+ except:
+ pass
+ elif not thread_list:
continue
- try:
- irq = int(ps[pid]["stat"]["comm"][4:])
- if irq not in irq_list_numbers:
- continue
- except:
- pass
try:
affinity = schedutils.get_affinity(pid)
except SystemError: # (3, 'No such process')