[gnome-boxes/wip/wizard-n-props-in-dialog2: 6/12] libvirt-machine-props: Add resource stats graphs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/wizard-n-props-in-dialog2: 6/12] libvirt-machine-props: Add resource stats graphs
- Date: Mon, 24 Nov 2014 13:04:55 +0000 (UTC)
commit e904b38940ac2e4256b280f2fd7622605da5b494
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sat Nov 22 18:21:17 2014 +0000
libvirt-machine-props: Add resource stats graphs
Add resource stats graphs to properties under 'System' page.
This is part of move of sidebar contents to main view before sidebar can
be dropped.
src/libvirt-machine-properties.vala | 44 +++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 5718da2..2507827 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -139,6 +139,8 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
break;
case PropertiesPage.SYSTEM:
+ add_resource_usage_graphs (ref list);
+
var ram_property = add_ram_property (ref list);
var storage_property = add_storage_property (ref list);
mark_recommended_resources.begin (ram_property, storage_property);
@@ -432,6 +434,48 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
}
}
+ private void add_resource_usage_graphs (ref List<Boxes.Property> list) {
+ var grid = new Gtk.Grid ();
+ grid.row_spacing = 5;
+ grid.column_spacing = 10;
+ grid.column_homogeneous = true;
+
+ // CPU
+ var cpu_graph = new MiniGraph ();
+ cpu_graph.ymax = 100;
+ cpu_graph.npoints = 20;
+ grid.attach (cpu_graph, 0, 0, 1, 1);
+ var label = new Gtk.Label (_("CPU"));
+ grid.attach (label, 0, 1, 1, 1);
+
+ // I/O
+ var io_graph = new MiniGraph ();
+ io_graph.ymax = 20;
+ grid.attach (io_graph, 1, 0, 1, 1);
+ label = new Gtk.Label (_("I/O"));
+ grid.attach (label, 1, 1, 1, 1);
+
+ // Network
+ var net_graph = new MiniGraph ();
+ net_graph.ymax = 20;
+ grid.attach (net_graph, 2, 0, 1, 1);
+ label = new Gtk.Label (_("Network"));
+ grid.attach (label, 2, 1, 1, 1);
+
+ var stats_id = machine.stats_updated.connect (() => {
+ cpu_graph.points = machine.cpu_stats;
+ io_graph.points = machine.io_stats;
+ net_graph.points = machine.net_stats;
+ });
+
+ var prop = add_property (ref list, null, grid);
+ ulong flushed_id = 0;
+ flushed_id = prop.flushed.connect (() => {
+ machine.disconnect (stats_id);
+ prop.disconnect (flushed_id);
+ });
+ }
+
private SizeProperty? add_ram_property (ref List<Boxes.Property> list) {
try {
var max_ram = machine.connection.get_node_info ().memory;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]