Hi, Display a combined sparcline for rx & tx (network) and input & output (disk) in the Network I/O and Disk I/O columns in the vm machine overview. Bounds fixed as suggested by Cole. -- Guido
# HG changeset patch # User "Guido Günther <agx@xxxxxxxxxxx>" # Date 1224358137 -7200 # Node ID 2728eac561fb8f07f7499f95766b22ee016ba7e2 # Parent 8c2c1c5856c0a7de4eb81c5b8e77738ee90608fd draw a sparcline for network and disk traffic in the main overview diff -r 8c2c1c5856c0 -r 2728eac561fb src/virtManager/connection.py --- a/src/virtManager/connection.py Sat Oct 18 21:25:16 2008 +0200 +++ b/src/virtManager/connection.py Sat Oct 18 21:28:57 2008 +0200 @@ -1054,6 +1054,14 @@ def disk_io_rate(self): return self.disk_read_rate() + self.disk_write_rate() + + def disk_io_vector_limit(self, dummy): + """No point to accumulate unnormalized I/O for a conenction""" + return [ 0.0 ] + + def network_traffic_vector_limit(self, dummy): + """No point to accumulate unnormalized Rx/Tx for a conenction""" + return [ 0.0 ] def uuidstr(self, rawuuid): hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] diff -r 8c2c1c5856c0 -r 2728eac561fb src/virtManager/domain.py --- a/src/virtManager/domain.py Sat Oct 18 21:25:16 2008 +0200 +++ b/src/virtManager/domain.py Sat Oct 18 21:28:57 2008 +0200 @@ -423,6 +423,14 @@ vector.append(0) return vector + def in_out_vector_limit(self, data, limit): + l = len(data)/2 + end = [l, limit][l > limit] + if l > limit: + data = data[0:end] + data[l:l+end] + d = map(lambda x,y: (x + y)/2, data[0:end], data[end:end*2]) + return d + def network_traffic_vector(self): vector = [] stats = self.record @@ -435,6 +443,9 @@ vector.append(0.0) return vector + def network_traffic_vector_limit(self, limit): + return self.in_out_vector_limit(self.network_traffic_vector(), limit) + def disk_io_vector(self): vector = [] stats = self.record @@ -446,6 +457,9 @@ else: vector.append(0.0) return vector + + def disk_io_vector_limit(self, limit): + return self.in_out_vector_limit(self.disk_io_vector(), limit) def shutdown(self): self.vm.shutdown() diff -r 8c2c1c5856c0 -r 2728eac561fb src/virtManager/manager.py --- a/src/virtManager/manager.py Sat Oct 18 21:25:16 2008 +0200 +++ b/src/virtManager/manager.py Sat Oct 18 21:28:57 2008 +0200 @@ -863,6 +863,7 @@ cpuUsage_txt = gtk.CellRendererText() cpuUsage_img = sparkline.CellRendererSparkline() + cpuUsage_img.set_property("reversed", True) cpuUsageCol.pack_start(cpuUsage_txt, False) cpuUsageCol.pack_start(cpuUsage_img, False) cpuUsageCol.add_attribute(cpuUsage_txt, 'text', ROW_CPU) @@ -886,19 +887,27 @@ diskIOIn_txt = gtk.CellRendererText() diskIOOut_txt = gtk.CellRendererText() + diskIO_img = sparkline.CellRendererSparkline() + diskIO_img.set_property("reversed", True) diskIOCol.pack_start(diskIOIn_txt, False) diskIOCol.pack_start(diskIOOut_txt, False) + diskIOCol.pack_start(diskIO_img, False) diskIOCol.add_attribute(diskIOIn_txt, 'text', ROW_DISK_RD) diskIOCol.add_attribute(diskIOOut_txt, 'text', ROW_DISK_WR) + diskIOCol.set_cell_data_func(diskIO_img, self.disk_io_img, None) diskIOCol.set_visible(self.config.is_vmlist_disk_io_visible()) diskIOCol.set_sort_column_id(VMLIST_SORT_DISK_IO) networkTrafficIn_txt = gtk.CellRendererText() networkTrafficOut_txt = gtk.CellRendererText() + networkTraffic_img = sparkline.CellRendererSparkline() + networkTraffic_img.set_property("reversed", True) networkTrafficCol.pack_start(networkTrafficIn_txt, False) networkTrafficCol.pack_start(networkTrafficOut_txt, False) + networkTrafficCol.pack_start(networkTraffic_img, False) networkTrafficCol.add_attribute(networkTrafficIn_txt, 'text', ROW_NET_RX) networkTrafficCol.add_attribute(networkTrafficOut_txt, 'text', ROW_NET_TX) + networkTrafficCol.set_cell_data_func(networkTraffic_img, self.network_traffic_img, None) networkTrafficCol.set_visible(self.config.is_vmlist_network_traffic_visible()) networkTrafficCol.set_sort_column_id(VMLIST_SORT_NETWORK_USAGE) @@ -997,7 +1006,18 @@ if model.get_value(iter, ROW_HANDLE) is None: return data = model.get_value(iter, ROW_HANDLE).cpu_time_vector_limit(40) - data.reverse() + cell.set_property('data_array', data) + + def disk_io_img(self, column, cell, model, iter, data): + if model.get_value(iter, ROW_HANDLE) is None: + return + data = model.get_value(iter, ROW_HANDLE).disk_io_vector_limit(40) + cell.set_property('data_array', data) + + def network_traffic_img(self, column, cell, model, iter, data): + if model.get_value(iter, ROW_HANDLE) is None: + return + data = model.get_value(iter, ROW_HANDLE).network_traffic_vector_limit(40) cell.set_property('data_array', data) def start_vm(self, ignore):
_______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools