diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-09-14 00:16:02 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-09-14 00:16:02 -0300 |
commit | 8e09a4fed166da73fc00dc3e751292dd747fedf7 (patch) | |
tree | ba87ceb8f8ce2a974b780590027bb13e7eedc76f | |
parent | 9dd83aac84c2b4ad0b38aa3afe295ddcd634d800 (diff) | |
download | tuna-8e09a4fed166da73fc00dc3e751292dd747fedf7.tar.gz |
tuna_gui: Allow moving threads/irqs to a CPU socket
Using drag'n'drop from the irq and process views to the
CPU socket frame, that will set the affinity mask to the
CPUs in the socket.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tuna/tuna_gui.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py index 5365a08..7aba699 100644 --- a/tuna/tuna_gui.py +++ b/tuna/tuna_gui.py @@ -132,6 +132,24 @@ class cpu_socket_frame(gtk.Frame): self.drop_handlers = { "pid": (drop_handler_move_threads_to_cpu, self.creator.procview), "irq": (drop_handler_move_irqs_to_cpu, self.creator.irqview), } + self.drag_dest_set(gtk.DEST_DEFAULT_ALL, DND_TARGETS, + gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE) + self.connect("drag_data_received", + self.on_frame_drag_data_received_data) + + def on_frame_drag_data_received_data(self, w, context, x, y, + selection, info, etime): + # Move to all CPUs in this socket + cpus = [ int(cpu.name[3:]) for cpu in self.cpus ] + # pid list, a irq list, etc + source, data = selection.data.split(":") + + if self.drop_handlers.has_key(source): + if self.drop_handlers[source][0](cpus, data): + self.drop_handlers[source][1].refresh() + else: + print "cpu_socket_frame: unhandled drag source '%s'" % source + def on_drag_data_received_data(self, treeview, context, x, y, selection, info, etime): drop_info = treeview.get_dest_row_at_pos(x, y) |