use the new multiline feature of the sparcline widget

to draw both rx/tx and read/write into one graph each.
This commit is contained in:
Guido Gunther 2008-10-18 21:24:19 +02:00
parent 655a846ac3
commit 8eced9b61b
2 changed files with 18 additions and 12 deletions

View File

@ -191,10 +191,14 @@ class vmmDetails(gobject.GObject):
self.disk_io_graph = sparkline.Sparkline()
self.disk_io_graph.set_property("reversed", True)
self.disk_io_graph.set_property("filled", False)
self.disk_io_graph.set_property("num_sets", 2)
self.window.get_widget("graph-table").attach(self.disk_io_graph, 1, 2, 2, 3)
self.network_traffic_graph = sparkline.Sparkline()
self.network_traffic_graph.set_property("reversed", True)
self.network_traffic_graph.set_property("filled", False)
self.network_traffic_graph.set_property("num_sets", 2)
self.window.get_widget("graph-table").attach(self.network_traffic_graph, 1, 2, 3, 4)
self.accel_groups = gtk.accel_groups_from_object(topwin)

View File

@ -426,23 +426,25 @@ class vmmDomain(gobject.GObject):
def network_traffic_vector(self):
vector = []
stats = self.record
for i in range(self.config.get_stats_history_length()+1):
if i < len(stats):
vector.append(float(stats[i]["netRxRate"])/
float(self.maxRecord["netRxRate"]))
else:
vector.append(0.0)
ceil = float(max(self.maxRecord["netRxRate"], self.maxRecord["netTxRate"]))
for n in [ "netRxRate", "netTxRate" ]:
for i in range(self.config.get_stats_history_length()+1):
if i < len(stats):
vector.append(float(stats[i][n])/ceil)
else:
vector.append(0.0)
return vector
def disk_io_vector(self):
vector = []
stats = self.record
for i in range(self.config.get_stats_history_length()+1):
if i < len(stats):
vector.append(float(stats[i]["diskRdRate"])/
float(self.maxRecord["diskRdRate"]))
else:
vector.append(0.0)
ceil = float(max(self.maxRecord["diskRdRate"], self.maxRecord["diskWrRate"]))
for n in [ "diskRdRate", "diskWrRate" ]:
for i in range(self.config.get_stats_history_length()+1):
if i < len(stats):
vector.append(float(stats[i][n])/ceil)
else:
vector.append(0.0)
return vector
def shutdown(self):