diff --git a/data/com.github.stsdc.monitor.gschema.xml b/data/com.github.stsdc.monitor.gschema.xml
index a242f8ff..4bc27dbf 100644
--- a/data/com.github.stsdc.monitor.gschema.xml
+++ b/data/com.github.stsdc.monitor.gschema.xml
@@ -45,16 +45,21 @@
To show CPU usage in Monitor Indicator or not
To show CPU usage in Monitor Indicator or not
+
+ false
+ To show CPU frequency in Monitor Indicator or not
+ To show CPU frequency in Monitor Indicator or not
+
+
+ true
+ To show CPU temperature value in Monitor Indicator or not
+ To show CPU temperature value in Monitor Indicator or not
+
true
To show memory usage in Monitor Indicator or not
To show memory usage in Monitor Indicator or not
-
- true
- To show temperature value in Monitor Indicator or not
- To show temperature value in Monitor Indicator or not
-
false
To show network up bandwidth data in Monitor Indicator or not
@@ -70,6 +75,11 @@
To show GPU used percentage in Monitor Indicator or not
To show GPU used percentage in Monitor Indicator or not
+
+ false
+ To show GPU memory usage in Monitor Indicator or not
+ To show GPU memory usage in Monitor Indicator or not
+
false
To show GPU temperature in Monitor Indicator or not
diff --git a/data/icons/gpu-vram-symbolic.svg b/data/icons/gpu-vram-symbolic.svg
new file mode 100644
index 00000000..5b97cf1a
--- /dev/null
+++ b/data/icons/gpu-vram-symbolic.svg
@@ -0,0 +1,151 @@
+
+
diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml
index fc41b25c..ed6a446b 100644
--- a/data/icons/icons.indicator.gresource.xml
+++ b/data/icons/icons.indicator.gresource.xml
@@ -2,8 +2,9 @@
cpu-symbolic.svg
- ram-symbolic.svg
gpu-symbolic.svg
+ ram-symbolic.svg
+ gpu-vram-symbolic.svg
swap-symbolic.svg
file-deleted-symbolic.svg
temperature-sensor-symbolic.svg
diff --git a/src/Indicator/Indicator.vala b/src/Indicator/Indicator.vala
index 0a95547e..ecb31411 100644
--- a/src/Indicator/Indicator.vala
+++ b/src/Indicator/Indicator.vala
@@ -24,31 +24,37 @@ public class Monitor.Indicator : Wingpanel.Indicator {
dbusclient.monitor_appeared.connect (() => {
this.visible = settings.get_boolean ("indicator-state");
display_widget.cpu_widget.visible = settings.get_boolean ("indicator-cpu-state");
+ display_widget.cpu_frequency_widget.visible = settings.get_boolean ("indicator-cpu-frequency-state");
+ display_widget.cpu_temperature_widget.visible = settings.get_boolean ("indicator-cpu-temperature-state");
display_widget.memory_widget.visible = settings.get_boolean ("indicator-memory-state");
- display_widget.temperature_widget.visible = settings.get_boolean ("indicator-temperature-state");
display_widget.network_up_widget.visible = settings.get_boolean ("indicator-network-upload-state");
display_widget.network_down_widget.visible = settings.get_boolean ("indicator-network-download-state");
display_widget.gpu_widget.visible = settings.get_boolean ("indicator-gpu-state");
+ display_widget.gpu_memory_widget.visible = settings.get_boolean ("indicator-gpu-memory-state");
display_widget.gpu_temperature_widget.visible = settings.get_boolean ("indicator-gpu-temperature-state");
});
dbusclient.interface.indicator_state.connect ((state) => this.visible = state);
dbusclient.interface.indicator_cpu_state.connect ((state) => display_widget.cpu_widget.visible = state);
+ dbusclient.interface.indicator_cpu_frequency_state.connect ((state) => display_widget.cpu_frequency_widget.visible = state);
+ dbusclient.interface.indicator_cpu_temperature_state.connect ((state) => display_widget.cpu_temperature_widget.visible = state);
dbusclient.interface.indicator_memory_state.connect ((state) => display_widget.memory_widget.visible = state);
- dbusclient.interface.indicator_temperature_state.connect ((state) => display_widget.temperature_widget.visible = state);
dbusclient.interface.indicator_network_up_state.connect ((state) => display_widget.network_up_widget.visible = state);
dbusclient.interface.indicator_network_down_state.connect ((state) => display_widget.network_down_widget.visible = state);
dbusclient.interface.indicator_gpu_state.connect ((state) => display_widget.gpu_widget.visible = state);
+ dbusclient.interface.indicator_gpu_memory_state.connect ((state) => display_widget.gpu_memory_widget.visible = state);
dbusclient.interface.indicator_gpu_temperature_state.connect ((state) => display_widget.gpu_temperature_widget.visible = state);
dbusclient.interface.update.connect ((sysres) => {
display_widget.cpu_widget.state_percentage = sysres.cpu_percentage;
- display_widget.temperature_widget.state_temperature = (int) Math.round (sysres.cpu_temperature);
+ display_widget.cpu_frequency_widget.state_frequency = sysres.cpu_frequency;
+ display_widget.cpu_temperature_widget.state_temperature = (int) Math.round (sysres.cpu_temperature);
display_widget.memory_widget.state_percentage = sysres.memory_percentage;
display_widget.network_up_widget.state_bandwidth = sysres.network_up;
display_widget.network_down_widget.state_bandwidth = sysres.network_down;
display_widget.gpu_widget.state_percentage = sysres.gpu_percentage;
+ display_widget.gpu_memory_widget.state_percentage = sysres.gpu_memory_percentage;
display_widget.gpu_temperature_widget.state_temperature = (int) Math.round (sysres.gpu_temperature);
});
diff --git a/src/Indicator/Services/DBusClient.vala b/src/Indicator/Services/DBusClient.vala
index b15bfde9..0cfb81eb 100644
--- a/src/Indicator/Services/DBusClient.vala
+++ b/src/Indicator/Services/DBusClient.vala
@@ -5,11 +5,13 @@ public interface Monitor.DBusClientInterface : Object {
public signal void update (ResourcesSerialized data);
public signal void indicator_state (bool state);
public signal void indicator_cpu_state (bool state);
+ public signal void indicator_cpu_frequency_state (bool state);
+ public signal void indicator_cpu_temperature_state (bool state);
public signal void indicator_memory_state (bool state);
- public signal void indicator_temperature_state (bool state);
public signal void indicator_network_up_state (bool state);
public signal void indicator_network_down_state (bool state);
public signal void indicator_gpu_state (bool state);
+ public signal void indicator_gpu_memory_state (bool state);
public signal void indicator_gpu_temperature_state (bool state);
}
diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala
index 3dc40ed2..eb1992ed 100644
--- a/src/Indicator/Widgets/DisplayWidget.vala
+++ b/src/Indicator/Widgets/DisplayWidget.vala
@@ -1,22 +1,27 @@
public class Monitor.Widgets.DisplayWidget : Gtk.Grid {
public IndicatorWidget cpu_widget = new IndicatorWidget ("cpu-symbolic");
+ public IndicatorWidget cpu_frequency_widget = new IndicatorWidget ("cpu-symbolic");
+ public IndicatorWidget cpu_temperature_widget = new IndicatorWidget ("temperature-sensor-symbolic");
+
public IndicatorWidget memory_widget = new IndicatorWidget ("ram-symbolic");
- public IndicatorWidget temperature_widget = new IndicatorWidget ("temperature-sensor-symbolic");
public IndicatorWidget network_up_widget = new IndicatorWidget ("go-up-symbolic");
public IndicatorWidget network_down_widget = new IndicatorWidget ("go-down-symbolic");
public IndicatorWidget gpu_widget = new IndicatorWidget ("gpu-symbolic");
+ public IndicatorWidget gpu_memory_widget = new IndicatorWidget ("gpu-vram-symbolic");
public IndicatorWidget gpu_temperature_widget = new IndicatorWidget ("temperature-gpu-symbolic");
construct {
valign = Gtk.Align.CENTER;
add (cpu_widget);
+ add (cpu_frequency_widget);
+ add (cpu_temperature_widget);
add (memory_widget);
add (gpu_widget);
+ add (gpu_memory_widget);
add (gpu_temperature_widget);
- add (temperature_widget);
add (network_up_widget);
add (network_down_widget);
}
diff --git a/src/Indicator/Widgets/IndicatorWidget.vala b/src/Indicator/Widgets/IndicatorWidget.vala
index fd18308b..0344e0f8 100644
--- a/src/Indicator/Widgets/IndicatorWidget.vala
+++ b/src/Indicator/Widgets/IndicatorWidget.vala
@@ -23,6 +23,12 @@ public class Monitor.IndicatorWidget : Gtk.Box {
}
}
+ public double state_frequency {
+ set {
+ label.label = ("%.2f %s").printf (value, _("GHz"));
+ }
+ }
+
public int state_bandwidth {
set {
label.label = ("%s").printf (Utils.HumanUnitFormatter.string_bytes_to_human (value.to_string (), true));
diff --git a/src/Resources/GPU/GPUNvidia.vala b/src/Resources/GPU/GPUNvidia.vala
index 1074d6a4..e9d5b687 100644
--- a/src/Resources/GPU/GPUNvidia.vala
+++ b/src/Resources/GPU/GPUNvidia.vala
@@ -9,6 +9,8 @@ public class Monitor.GPUNvidia : IGPU, Object {
public int memory_percentage { get; protected set; }
+ public int fb_percentage { get; protected set; }
+
public double memory_vram_used { get; protected set; }
public double memory_vram_total { get; set; }
@@ -19,8 +21,12 @@ public class Monitor.GPUNvidia : IGPU, Object {
public int nvidia_memory_vram_used = 0;
+ public int nvidia_memory_vram_total = 0;
+
public int nvidia_memory_percentage = 0;
+ public int nvidia_fb_percentage = 0;
+
public int nvidia_percentage = 0;
public char * nvidia_used = "";
@@ -29,6 +35,8 @@ public class Monitor.GPUNvidia : IGPU, Object {
public bool nvidia_resources_vram_used;
+ public bool nvidia_resources_vram_total;
+
public bool nvidia_resources_used;
public X.Display nvidia_display;
@@ -66,6 +74,20 @@ public class Monitor.GPUNvidia : IGPU, Object {
return;
}
+ nvidia_resources_vram_total = NVCtrl.XNVCTRLQueryTargetAttribute (
+ nvidia_display,
+ NV_CTRL_TARGET_TYPE_GPU,
+ 0,
+ 0,
+ NV_CTRL_TOTAL_DEDICATED_GPU_MEMORY,
+ &nvidia_memory_vram_total
+ );
+
+ if (!nvidia_resources_vram_total) {
+ warning ("Could not query NV_CTRL_TOTAL_DEDICATED_GPU_MEMORY attribute!\n");
+ return;
+ }
+
nvidia_resources_used = NVCtrl.XNVCTRLQueryTargetStringAttribute (
nvidia_display,
NV_CTRL_TARGET_TYPE_GPU,
@@ -77,9 +99,9 @@ public class Monitor.GPUNvidia : IGPU, Object {
// var str_used = (string)nvidia_used;
nvidia_percentage = int.parse (((string) nvidia_used).split_set ("=,")[1]);
- nvidia_memory_percentage = int.parse (((string) nvidia_used).split_set ("=,")[3]);
+ nvidia_fb_percentage = int.parse (((string) nvidia_used).split_set ("=,")[3]);
debug ("USED_GRAPHICS: %d%\n", nvidia_percentage);
- debug ("USED_MEMORY: %d%\n", nvidia_memory_percentage);
+ debug ("USED_FB_MEMORY: %d%\n", nvidia_fb_percentage);
if (!nvidia_resources_used) {
warning ("Could not query NV_CTRL_STRING_GPU_UTILIZATION attribute!\n");
@@ -93,14 +115,19 @@ public class Monitor.GPUNvidia : IGPU, Object {
}
private void update_memory_vram_used () {
- memory_vram_used = (double) nvidia_memory_vram_used;
+ memory_vram_used = (double) nvidia_memory_vram_used * 1000000.0;
}
private void update_memory_vram_total () {
+ memory_vram_total = (double) nvidia_memory_vram_total * 1000000.0;
}
private void update_memory_percentage () {
- memory_percentage = nvidia_memory_percentage;
+ memory_percentage = (int) (Math.round ((memory_vram_used / memory_vram_total) * 100));
+ }
+
+ private void update_fb_percentage () {
+ fb_percentage = nvidia_fb_percentage;
}
private void update_percentage () {
@@ -111,6 +138,7 @@ public class Monitor.GPUNvidia : IGPU, Object {
update_nv_resources ();
update_temperature ();
update_memory_vram_used ();
+ update_memory_vram_total ();
update_memory_percentage ();
update_percentage ();
}
diff --git a/src/Resources/Resources.vala b/src/Resources/Resources.vala
index 1238dd0b..00353c83 100644
--- a/src/Resources/Resources.vala
+++ b/src/Resources/Resources.vala
@@ -75,19 +75,22 @@ public class Monitor.Resources : Object {
public ResourcesSerialized serialize () {
return ResourcesSerialized () {
- cpu_percentage = cpu.percentage,
- cpu_frequency = cpu.frequency,
- cpu_temperature = cpu.temperature_mean,
- memory_percentage = memory.used_percentage,
- memory_used = memory.used,
- memory_total = memory.total,
- swap_percentage = swap.percentage,
- swap_used = swap.used,
- swap_total = swap.total,
- network_up = network.bytes_out,
- network_down = network.bytes_in,
- gpu_percentage = gpu != null ? gpu.percentage : 0,
- gpu_temperature = gpu.temperature
+ cpu_percentage = cpu.percentage,
+ cpu_frequency = cpu.frequency,
+ cpu_temperature = cpu.temperature_mean,
+ memory_percentage = memory.used_percentage,
+ memory_used = memory.used,
+ memory_total = memory.total,
+ swap_percentage = swap.percentage,
+ swap_used = swap.used,
+ swap_total = swap.total,
+ network_up = network.bytes_out,
+ network_down = network.bytes_in,
+ gpu_percentage = gpu != null ? gpu.percentage : 0,
+ gpu_memory_percentage = gpu != null ? gpu.memory_percentage : 0,
+ gpu_memory_used = gpu != null ? gpu.memory_vram_used : 0,
+ gpu_memory_total = gpu != null ? gpu.memory_vram_total : 0,
+ gpu_temperature = gpu != null ? gpu.temperature : 0
};
}
}
diff --git a/src/Resources/ResourcesSerialized.vala b/src/Resources/ResourcesSerialized.vala
index b389793c..e19a2856 100644
--- a/src/Resources/ResourcesSerialized.vala
+++ b/src/Resources/ResourcesSerialized.vala
@@ -11,5 +11,8 @@ public struct ResourcesSerialized {
public int network_up;
public int network_down;
public int gpu_percentage;
+ public uint gpu_memory_percentage;
+ public double gpu_memory_used;
+ public double gpu_memory_total;
public double gpu_temperature;
}
diff --git a/src/Services/DBusServer.vala b/src/Services/DBusServer.vala
index f19f0840..d072be6f 100644
--- a/src/Services/DBusServer.vala
+++ b/src/Services/DBusServer.vala
@@ -12,11 +12,13 @@ public class Monitor.DBusServer : Object {
public signal void update (ResourcesSerialized data);
public signal void indicator_state (bool state);
public signal void indicator_cpu_state (bool state);
+ public signal void indicator_cpu_frequency_state (bool state);
+ public signal void indicator_cpu_temperature_state (bool state);
public signal void indicator_memory_state (bool state);
- public signal void indicator_temperature_state (bool state);
public signal void indicator_network_up_state (bool state);
public signal void indicator_network_down_state (bool state);
public signal void indicator_gpu_state (bool state);
+ public signal void indicator_gpu_memory_state (bool state);
public signal void indicator_gpu_temperature_state (bool state);
public signal void quit ();
public signal void show ();
diff --git a/src/Views/PreferencesView/PreferencesIndicatorPage.vala b/src/Views/PreferencesView/PreferencesIndicatorPage.vala
index 57af79ba..038e045b 100644
--- a/src/Views/PreferencesView/PreferencesIndicatorPage.vala
+++ b/src/Views/PreferencesView/PreferencesIndicatorPage.vala
@@ -34,6 +34,31 @@
dbusserver.indicator_cpu_state (cpu_percentage_switch.state);
});
+ var cpu_frequency_label = new Gtk.Label (_("Display CPU frequency"));
+ cpu_frequency_label.halign = Gtk.Align.START;
+ cpu_frequency_label.xalign = 1;
+
+ var cpu_frequency_switch = new Gtk.Switch ();
+ cpu_frequency_switch.halign = Gtk.Align.END;
+ cpu_frequency_switch.hexpand = true;
+ cpu_frequency_switch.state = MonitorApp.settings.get_boolean ("indicator-cpu-frequency-state");
+ cpu_frequency_switch.notify["active"].connect (() => {
+ MonitorApp.settings.set_boolean ("indicator-cpu-frequency-state", cpu_frequency_switch.state);
+ dbusserver.indicator_cpu_frequency_state (cpu_frequency_switch.state);
+ });
+
+ var cpu_temperature_label = new Gtk.Label (_("Display CPU temperature"));
+ cpu_temperature_label.halign = Gtk.Align.START;
+ cpu_temperature_label.xalign = 1;
+
+ var cpu_temperature_switch = new Gtk.Switch ();
+ cpu_temperature_switch.halign = Gtk.Align.END;
+ cpu_temperature_switch.state = MonitorApp.settings.get_boolean ("indicator-cpu-temperature-state");
+ cpu_temperature_switch.notify["active"].connect (() => {
+ MonitorApp.settings.set_boolean ("indicator-cpu-temperature-state", cpu_temperature_switch.state);
+ dbusserver.indicator_cpu_temperature_state (cpu_temperature_switch.state);
+ });
+
var memory_label = new Gtk.Label (_("Display RAM percentage"));
memory_label.halign = Gtk.Align.START;
memory_label.xalign = 1;
@@ -46,18 +71,6 @@
dbusserver.indicator_memory_state (memory_percentage_switch.state);
});
- var temperature_label = new Gtk.Label (_("Display temperature"));
- temperature_label.halign = Gtk.Align.START;
- temperature_label.xalign = 1;
-
- var temperature_switch = new Gtk.Switch ();
- temperature_switch.halign = Gtk.Align.END;
- temperature_switch.state = MonitorApp.settings.get_boolean ("indicator-temperature-state");
- temperature_switch.notify["active"].connect (() => {
- MonitorApp.settings.set_boolean ("indicator-temperature-state", temperature_switch.state);
- dbusserver.indicator_temperature_state (temperature_switch.state);
- });
-
var network_upload_label = new Gtk.Label (_("Display network upload"));
network_upload_label.halign = Gtk.Align.START;
network_upload_label.xalign = 1;
@@ -94,9 +107,21 @@
dbusserver.indicator_gpu_state (gpu_percentage_switch.state);
});
+ var gpu_memory_label = new Gtk.Label (_("Display VRAM percentage"));
+ gpu_memory_label.halign = Gtk.Align.START;
+ gpu_memory_label.xalign = 1;
+
+ var gpu_memory_switch = new Gtk.Switch ();
+ gpu_memory_switch.halign = Gtk.Align.END;
+ gpu_memory_switch.state = MonitorApp.settings.get_boolean ("indicator-gpu-memory-state");
+ gpu_memory_switch.notify["active"].connect (() => {
+ MonitorApp.settings.set_boolean ("indicator-gpu-temperature-state", gpu_memory_switch.state);
+ dbusserver.indicator_gpu_memory_state (gpu_memory_switch.state);
+ });
+
var gpu_temperature_label = new Gtk.Label (_("Display GPU temperature"));
- gpu_label.halign = Gtk.Align.START;
- gpu_label.xalign = 1;
+ gpu_temperature_label.halign = Gtk.Align.START;
+ gpu_temperature_label.xalign = 1;
var gpu_temperature_switch = new Gtk.Switch ();
gpu_temperature_switch.halign = Gtk.Align.END;
@@ -106,26 +131,51 @@
dbusserver.indicator_gpu_temperature_state (gpu_temperature_switch.state);
});
- content_area.attach (cpu_label, 0, 0, 1, 1);
- content_area.attach (cpu_percentage_switch, 1, 0, 1, 1);
+ var row = 0;
+
+ content_area.attach (cpu_label, 0, row, 1, 1);
+ content_area.attach (cpu_percentage_switch, 1, row, 1, 1);
+ row++;
+
+ content_area.attach (cpu_frequency_label, 0, row, 1, 1);
+ content_area.attach (cpu_frequency_switch, 1, row, 1, 1);
+ row++;
+
+ content_area.attach (cpu_temperature_label, 0, row, 1, 1);
+ content_area.attach (cpu_temperature_switch, 1, row, 1, 1);
+ row++;
+
+ content_area.attach (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, row, 2, 1);
+ row++;
+
+ content_area.attach (memory_label, 0, row, 1, 1);
+ content_area.attach (memory_percentage_switch, 1, row, 1, 1);
+ row++;
+
+ content_area.attach (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, row, 2, 1);
+ row++;
- content_area.attach (memory_label, 0, 1, 1, 1);
- content_area.attach (memory_percentage_switch, 1, 1, 1, 1);
+ content_area.attach (gpu_label, 0, row, 1, 1);
+ content_area.attach (gpu_percentage_switch, 1, row, 1, 1);
+ row++;
- content_area.attach (gpu_label, 0, 2, 1, 1);
- content_area.attach (gpu_percentage_switch, 1, 2, 1, 1);
+ content_area.attach (gpu_memory_label, 0, row, 1, 1);
+ content_area.attach (gpu_memory_switch, 1, row, 1, 1);
+ row++;
- content_area.attach (gpu_temperature_label, 0, 3, 1, 1);
- content_area.attach (gpu_temperature_switch, 1, 3, 1, 1);
+ content_area.attach (gpu_temperature_label, 0, row, 1, 1);
+ content_area.attach (gpu_temperature_switch, 1, row, 1, 1);
+ row++;
- content_area.attach (temperature_label, 0, 4, 1, 1);
- content_area.attach (temperature_switch, 1, 4, 1, 1);
+ content_area.attach (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, row, 2, 1);
+ row++;
- content_area.attach (network_upload_label, 0, 5, 1, 1);
- content_area.attach (network_upload_switch, 1, 5, 1, 1);
+ content_area.attach (network_upload_label, 0, row, 1, 1);
+ content_area.attach (network_upload_switch, 1, row, 1, 1);
+ row++;
- content_area.attach (network_download_label, 0, 6, 1, 1);
- content_area.attach (network_download_switch, 1, 6, 1, 1);
+ content_area.attach (network_download_label, 0, row, 1, 1);
+ content_area.attach (network_download_switch, 1, row, 1, 1);
update_status ();
diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala
index ed45634c..1ccdd42a 100644
--- a/src/Widgets/Statusbar/Statusbar.vala
+++ b/src/Widgets/Statusbar/Statusbar.vala
@@ -2,6 +2,8 @@ public class Monitor.Statusbar : Gtk.ActionBar {
Gtk.Label cpu_usage_label;
Gtk.Label memory_usage_label;
Gtk.Label swap_usage_label;
+ Gtk.Label gpu_usage_label;
+ Gtk.Label gpu_memory_usage_label;
construct {
var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR) {
@@ -16,6 +18,10 @@ public class Monitor.Statusbar : Gtk.ActionBar {
tooltip_text = _("Swap")
};
+ var gpu_icon = new Gtk.Image.from_icon_name ("gpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR) {
+ tooltip_text = _("GPU")
+ };
+
cpu_usage_label = new Gtk.Label (_("Calculating…"));
cpu_usage_label.set_width_chars (4);
cpu_usage_label.xalign = 0;
@@ -36,6 +42,13 @@ public class Monitor.Statusbar : Gtk.ActionBar {
pack_start (swap_icon);
pack_start (swap_usage_label);
+ gpu_usage_label = new Gtk.Label (_("Calculating…"));
+ gpu_usage_label.set_width_chars (4);
+ gpu_usage_label.xalign = 0;
+ gpu_icon.margin_start = 6;
+ pack_start (gpu_icon);
+ pack_start (gpu_usage_label);
+
var support_ua_label = new Gtk.LinkButton.with_label ("http://stand-with-ukraine.pp.ua/", _("🇺🇦"));
var github_label = new Gtk.LinkButton.with_label ("https://github.com/stsdc/monitor", _("Check on Github"));
@@ -65,6 +78,8 @@ public class Monitor.Statusbar : Gtk.ActionBar {
public bool update (ResourcesSerialized sysres) {
cpu_usage_label.set_text (("%d%%").printf (sysres.cpu_percentage));
memory_usage_label.set_text (("%u%%").printf (sysres.memory_percentage));
+ gpu_usage_label.set_text (("%d%%").printf (sysres.gpu_percentage));
+ gpu_memory_usage_label.set_text (("%u%%").printf (sysres.gpu_memory_percentage));
string cpu_tooltip_text = ("%.2f %s").printf (sysres.cpu_frequency, _("GHz"));
cpu_usage_label.tooltip_text = cpu_tooltip_text;
@@ -72,6 +87,9 @@ public class Monitor.Statusbar : Gtk.ActionBar {
string memory_tooltip_text = ("%s / %s").printf (Utils.HumanUnitFormatter.double_bytes_to_human (sysres.memory_used), Utils.HumanUnitFormatter.double_bytes_to_human (sysres.memory_total));
memory_usage_label.tooltip_text = memory_tooltip_text;
+ string gpu_memory_tooltip_text = ("%s / %s").printf (Utils.HumanUnitFormatter.double_bytes_to_human (sysres.gpu_memory_used), Utils.HumanUnitFormatter.double_bytes_to_human (sysres.gpu_memory_total));
+ gpu_memory_usage_label.tooltip_text = gpu_memory_tooltip_text;
+
// The total amount of the swap is 0 when it is unavailable
if (sysres.swap_total == 0) {
swap_usage_label.set_text ("N/A");
diff --git a/tests/test_statusbar.vala b/tests/test_statusbar.vala
index b0ad7c78..29ca5eb3 100644
--- a/tests/test_statusbar.vala
+++ b/tests/test_statusbar.vala
@@ -16,7 +16,10 @@ private void test_statusbar () {
swap_used = 0.1,
swap_total = 1.0,
network_up = 12,
- network_down = 23
+ network_down = 23,
+ gpu_percentage = 20
+ gpu_memory_percentage = 10
+ gpu_temperature = 31.0
};
bool update_result = statusbar.update (sysres);
diff --git a/vapi/libxnvctrl.vapi b/vapi/libxnvctrl.vapi
index 472829e5..3e3b8d2a 100644
--- a/vapi/libxnvctrl.vapi
+++ b/vapi/libxnvctrl.vapi
@@ -35,6 +35,7 @@ public const uint NV_CTRL_GPU_CURRENT_CLOCK_FREQS;
public const uint NV_CTRL_TOTAL_GPU_MEMORY;
public const uint NV_CTRL_STRING_GPU_UTILIZATION;
public const uint NV_CTRL_USED_DEDICATED_GPU_MEMORY;
+public const uint NV_CTRL_TOTAL_DEDICATED_GPU_MEMORY;
public const uint NV_CTRL_GPU_CURRENT_PROCESSOR_CLOCK_FREQS;
public const uint NV_CTRL_STRING_PRODUCT_NAME;
public const uint NV_CTRL_PCI_ID;