Commit 4e1bb2de authored by Petr Štětka's avatar Petr Štětka
Browse files

Added swap in memory graph.

parent 398cc639
......@@ -4,13 +4,18 @@ namespace Usage {
public class MemoryGraphTable : Rg.Table
{
public const int column_ram_id = 0;
public const int column_swap_id = 1;
public MemoryGraphTable (uint timespan, uint max_samples)
{
set_timespan (timespan * 1000);
set_max_samples (max_samples);
var column = new Rg.Column("TOTAL CPU", Type.from_name("gdouble"));
add_column(column);
var column_ram = new Rg.Column("RAM", Type.from_name("gdouble"));
add_column(column_ram);
var column_swap = new Rg.Column("SWAP", Type.from_name("gdouble"));
add_column(column_swap);
var interval = timespan / (max_samples - 1);
var monitor = (GLib.Application.get_default() as Application).monitor;
......@@ -25,7 +30,8 @@ namespace Usage {
{
Rg.TableIter iter;
push (out iter, get_monotonic_time ());
iter.set (0, (GLib.Application.get_default() as Application).monitor.mem_usage_graph, -1);
iter.set (column_ram_id, (GLib.Application.get_default() as Application).monitor.mem_usage_graph, -1);
iter.set (column_swap_id, (GLib.Application.get_default() as Application).monitor.swap_usage_graph, -1);
return true;
}
......
......@@ -16,10 +16,17 @@ namespace Usage
else
set_table(table);
LineRenderer renderer = new LineRenderer();
renderer.stroke_color = "#ef2929";
renderer.line_width = 2;
add_renderer(renderer);
LineRenderer renderer_ram = new LineRenderer();
renderer_ram.column = MemoryGraphTable.column_ram_id;
renderer_ram.stroke_color = "#ef2929";
renderer_ram.line_width = 2;
add_renderer(renderer_ram);
LineRenderer renderer_swap = new LineRenderer();
renderer_swap.column = MemoryGraphTable.column_swap_id;
renderer_swap.stroke_color = "#73d216";
renderer_swap.line_width = 2;
add_renderer(renderer_swap);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment