Commit 662252a5 authored by Petr Štětka's avatar Petr Štětka
Browse files

Added multi and single version of CPU graph

In side menu are graphs.
Bigger default size of window.
Updated screenshot
parent 91d4cc8b
......@@ -29,6 +29,7 @@ c_library: gtop-2.0 ${CMAKE_SOURCE_DIR}/external/rg/librg.a ${CMAKE_SOURCE_DIR}/
*vala_source: disk-sub-view.vala
*vala_source: gnome-usage.vala
*vala_source: graph-stack-switcher.vala
*vala_source: graph-switcher-button.vala
*vala_source: header-bar.vala
*vala_source: memory-sub-view.vala
*vala_source: network-sub-view.vala
......@@ -48,13 +49,14 @@ h_folder: /usr/include/libgtop-2.0
*translate: vala src/cpu-graph.vala
*translate: vala src/system-monitor.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/performance-view.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/header-bar.vala
*translate: vala src/disk-sub-view.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/performance-view.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/view.vala
*translate: vala src/graph-switcher-button.vala
*translate: vala src/storage-view.vala
*translate: vala src/power-view.vala
*translate: vala src/process-list.vala
......
......@@ -6,6 +6,7 @@ src/data-view.vala
src/disk-sub-view.vala
src/gnome-usage.vala
src/graph-stack-switcher.vala
src/graph-switcher-button.vala
src/header-bar.vala
src/memory-sub-view.vala
src/network-sub-view.vala
......
screenshot.png

55.8 KB | W: | H:

screenshot.png

88.5 KB | W: | H:

screenshot.png
screenshot.png
screenshot.png
screenshot.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -43,6 +43,7 @@ set (APP_SOURCES ${APP_SOURCES} data-view.vala)
set (APP_SOURCES ${APP_SOURCES} disk-sub-view.vala)
set (APP_SOURCES ${APP_SOURCES} gnome-usage.vala)
set (APP_SOURCES ${APP_SOURCES} graph-stack-switcher.vala)
set (APP_SOURCES ${APP_SOURCES} graph-switcher-button.vala)
set (APP_SOURCES ${APP_SOURCES} header-bar.vala)
set (APP_SOURCES ${APP_SOURCES} memory-sub-view.vala)
set (APP_SOURCES ${APP_SOURCES} network-sub-view.vala)
......
......@@ -9,6 +9,17 @@ namespace Usage {
set_timespan (timespan * 1000);
set_max_samples (max_samples);
var column = new Rg.Column("TOTAL CPU", Type.from_name("gdouble"));
add_column(column);
(GLib.Application.get_default() as Application).monitor.set_update_graph_interval(timespan / (max_samples - 1)); //TODO move to settings!! Here is problem, that this will set all table ant it is problem.
Timeout.add(timespan / (max_samples - 1), update_data);
}
public CpuGraphTable.multi (uint timespan, uint max_samples)
{
set_timespan (timespan * 1000);
set_max_samples (max_samples);
for (int i = 0; i < get_num_processors(); i++)
{
......@@ -17,11 +28,19 @@ namespace Usage {
}
(GLib.Application.get_default() as Application).monitor.set_update_graph_interval(timespan / (max_samples - 1)); //TODO move to settings!! Here is problem, that this will set all table ant it is problem.
Timeout.add(timespan / (max_samples - 1), update_data);
Timeout.add(timespan / (max_samples - 1), update_data_multi);
}
bool update_data()
{
Rg.TableIter iter;
push (out iter, get_monotonic_time ());
iter.set (0, (GLib.Application.get_default() as Application).monitor.cpu_load_graph, -1);
return true;
}
bool update_data_multi()
{
Rg.TableIter iter;
push (out iter, get_monotonic_time ());
......
......@@ -16,6 +16,7 @@ namespace Usage {
};
private static CpuGraphTable table;
private static CpuGraphTable table_multi;
public CpuGraph (int64 timespan, int64 max_samples)
{
......@@ -27,6 +28,21 @@ namespace Usage {
else
set_table(table);
LineRenderer renderer = new LineRenderer();
renderer.stroke_color = colors [0];
add_renderer(renderer);
}
public CpuGraph.multi (int64 timespan, int64 max_samples)
{
if(table_multi == null)
{
table_multi = new CpuGraphTable.multi(30000, 60);
set_table(table_multi);
}
else
set_table(table_multi);
for(int i = 0; i < get_num_processors(); i++)
{
LineRenderer renderer = new LineRenderer();
......
......@@ -27,7 +27,7 @@ namespace Usage
process_list_box = new ProcessList();
var cpu_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
var cpu_graph = new CpuGraph(30000000, 60);
var cpu_graph = new CpuGraph.multi(30000000, 60);
var cpu_graph_frame = new Gtk.Frame(null);
cpu_graph_frame.height_request = 200;
cpu_graph_frame.margin_start = margin_side;
......
......@@ -19,14 +19,10 @@ namespace Usage
this.stack = stack;
this.sub_views = sub_views;
cpu_button = new Gtk.ToggleButton.with_label("Processor");
cpu_button.relief = Gtk.ReliefStyle.NONE;
memory_button = new Gtk.ToggleButton.with_label("Memory");
memory_button.relief = Gtk.ReliefStyle.NONE;
disk_button = new Gtk.ToggleButton.with_label("Disk I/O");
disk_button.relief = Gtk.ReliefStyle.NONE;
network_button = new Gtk.ToggleButton.with_label("Network");
network_button.relief = Gtk.ReliefStyle.NONE;
cpu_button = new GraphSwitcherButton.processor("Processor");
memory_button = new GraphSwitcherButton.memory("Memory");
disk_button = new GraphSwitcherButton.disk("Disk I/O");
network_button = new GraphSwitcherButton.network("Network");
this.pack_start(cpu_button, false, true, 0);
this.pack_start(memory_button, false, true, 0);
......
namespace Usage
{
public class GraphSwitcherButton : Gtk.ToggleButton
{
public GraphSwitcherButton.processor(string label)
{
Rg.Graph processor_graph = new CpuGraph(30000000, 60);
child = createContent(processor_graph, label);
relief = Gtk.ReliefStyle.NONE;
}
public GraphSwitcherButton.memory(string label)
{
Rg.Graph memory_graph = new CpuGraph(30000000, 60);
child = createContent(memory_graph, label);
relief = Gtk.ReliefStyle.NONE;
}
public GraphSwitcherButton.disk(string label)
{
Rg.Graph disk_graph = new CpuGraph(30000000, 60);
child = createContent(disk_graph, label);
relief = Gtk.ReliefStyle.NONE;
}
public GraphSwitcherButton.network(string label)
{
Rg.Graph network_graph = new CpuGraph(30000000, 60);
child = createContent(network_graph, label);
relief = Gtk.ReliefStyle.NONE;
}
private Gtk.Box createContent(Rg.Graph graph, string label_text)
{
var graph_frame = new Gtk.Frame(null);
graph_frame.height_request = 80;
graph_frame.margin_top = 14;
graph_frame.margin_start = 9;
graph_frame.margin_end = 9;
graph_frame.add(graph);
var label = new Gtk.Label(label_text);
label.margin_top = 6;
label.margin_bottom = 3;
var box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
box.pack_start(graph_frame, true, true, 0);
box.pack_start(label, false, false, 0);
return box;
}
}
}
......@@ -25,6 +25,7 @@ namespace Usage
performance_stack.add_titled(sub_view, sub_view.name, sub_view.name);
var stackSwitcher = new GraphStackSwitcher(performance_stack, sub_views);
stackSwitcher.set_size_request(200, -1);
var paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
paned.add1(stackSwitcher);
......
......@@ -9,7 +9,7 @@ namespace Usage
{
GLib.Object(application : application);
this.set_default_size(800, 500);
this.set_default_size(950, 600);
this.window_position = Gtk.WindowPosition.CENTER;
stack = new Gtk.Stack();
......
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