diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-09-11 12:04:26 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-09-11 12:04:26 -0300 |
commit | 2e9904b0bb5c7bb821659193bbf9dd588819b32c (patch) | |
tree | 34d2918cbcc67e0621b745e9ffe3b3275d32d91b | |
parent | 209e2441747b565392d1c69075c4ddda091166e0 (diff) | |
download | tuna-2e9904b0bb5c7bb821659193bbf9dd588819b32c.tar.gz |
tuna_gui: Arrange the sockets in a matrix
One CPU socket:
[ ]
Two CPU sockets:
[ ] [ ]
Four:
[ ] [ ]
[ ] [ ]
...
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tuna/tuna_gui.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py index d3724eb..561ff2c 100644 --- a/tuna/tuna_gui.py +++ b/tuna/tuna_gui.py @@ -6,7 +6,7 @@ import pygtk pygtk.require("2.0") import copy, ethtool, gtk, gobject, os, pango, procfs, re, schedutils, sys, tuna -import sysfs +import sysfs, math import gtk.glade try: @@ -257,12 +257,30 @@ class cpuview: vbox = window.get_child().get_child() socket_ids = self.cpus.sockets.keys() socket_ids.sort() + + nr_sockets = len(socket_ids) + if nr_sockets > 1: + columns = math.ceil(math.sqrt(nr_sockets)) + rows = math.ceil(nr_sockets / columns) + box = gtk.HBox() + else: + box = vbox + + column = 1 for socket_id in socket_ids: frame = cpu_socket_frame(socket_id, self.cpus.sockets[socket_id], self) - vbox.pack_start(frame, False, False) + box.pack_start(frame, False, False) self.socket_frames[socket_id] = frame + if nr_sockets > 1: + if column == columns: + vbox.pack_start(box, True, True) + box = gtk.HBox() + column = 1 + else: + column += 1 + window.show_all() self.cpus_filtered = cpus_filtered |