summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2008-09-13 16:41:18 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2008-09-13 16:41:18 -0300
commita75670d9671bd35e18d115864a82e184d3bc4ad5 (patch)
treecfb77acfef342444a82a01e5f5f47937f417258e
parent0beb1235163caea9f4a9755668bf6c271f4cccd9 (diff)
downloadtuna-a75670d9671bd35e18d115864a82e184d3bc4ad5.tar.gz
tuna_gui: Allow dnd of threads/irqs to all CPUs in a socket
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tuna/tuna_gui.py25
1 files changed, 9 insertions, 16 deletions
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 5c75766..f7310e3 100644
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -38,22 +38,15 @@ def set_affinity_warning(tid, affinity):
dialog.run()
dialog.destroy()
-def drop_handler_move_threads_to_cpu(cpu, data):
+def drop_handler_move_threads_to_cpu(new_affinity, data):
pid_list = [ int(pid) for pid in data.split(",") ]
- if cpu >= 0:
- new_affinity = [ cpu, ]
- else:
- new_affinity = range(-cpu)
- tuna.move_threads_to_cpu(new_affinity, pid_list)
+ return tuna.move_threads_to_cpu(new_affinity, pid_list)
-def drop_handler_move_irqs_to_cpu(cpu, data):
+def drop_handler_move_irqs_to_cpu(cpus, data):
irq_list = [ int(irq) for irq in data.split(",") ]
- if cpu >= 0:
- new_affinity = [ 1 << cpu, ]
- else:
- cpu = -cpu
- new_affinity = [ (1 << cpu) - 1, ]
+ new_affinity = [ reduce(lambda a, b: a | b,
+ map(lambda cpu: 1 << cpu, cpus)), ]
for irq in irq_list:
tuna.set_irq_affinity(irq, new_affinity)
@@ -149,13 +142,13 @@ class cpu_socket_frame(gtk.Frame):
model = treeview.get_model()
path, position = drop_info
iter = model.get_iter(path)
- cpu = model.get_value(iter, self.COL_CPU)
+ cpus = [ model.get_value(iter, self.COL_CPU), ]
else:
- # Move to all CPUs
- cpu = -self.nr_cpus
+ # Move to all CPUs in this socket
+ cpus = [ int(cpu.name[3:]) for cpu in self.cpus ]
if self.drop_handlers.has_key(source):
- if self.drop_handlers[source][0](cpu, data):
+ if self.drop_handlers[source][0](cpus, data):
self.drop_handlers[source][1].refresh()
else:
print "cpu_socket_frame: unhandled drag source '%s'" % source