From 1e0645dfb2249a21918fefd9722b37b4bfb1190d Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:38:08 +0100 Subject: [PATCH] format --- src/Resources/GPU/GPUAmd.vala | 5 ++-- src/Resources/GPU/GPUNvidia.vala | 40 ++++++++++++++++++++------------ src/Resources/GPU/IGPU.vala | 3 ++- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/Resources/GPU/GPUAmd.vala b/src/Resources/GPU/GPUAmd.vala index 38ecc512..667ab300 100644 --- a/src/Resources/GPU/GPUAmd.vala +++ b/src/Resources/GPU/GPUAmd.vala @@ -1,5 +1,5 @@ public class Monitor.GPUAmd : IGPU, Object { - public SessionManager? session_manager { get; protected set; } + public SessionManager ? session_manager { get; protected set; } public Gee.HashMap hwmon_temperatures { get; set; } @@ -16,7 +16,7 @@ public class Monitor.GPUAmd : IGPU, Object { public double temperature { get; protected set; } construct { - // session_manager = get_sessman (); + // session_manager = get_sessman (); } private void update_temperature () { @@ -46,4 +46,5 @@ public class Monitor.GPUAmd : IGPU, Object { update_memory_percentage (); update_percentage (); } + } diff --git a/src/Resources/GPU/GPUNvidia.vala b/src/Resources/GPU/GPUNvidia.vala index 6c325634..1074d6a4 100644 --- a/src/Resources/GPU/GPUNvidia.vala +++ b/src/Resources/GPU/GPUNvidia.vala @@ -1,5 +1,5 @@ public class Monitor.GPUNvidia : IGPU, Object { - public SessionManager? session_manager { get; protected set; } + public SessionManager ? session_manager { get; protected set; } public Gee.HashMap hwmon_temperatures { get; set; } @@ -23,7 +23,7 @@ public class Monitor.GPUNvidia : IGPU, Object { public int nvidia_percentage = 0; - public char *nvidia_used = ""; + public char * nvidia_used = ""; public bool nvidia_resources_temperature; @@ -34,7 +34,7 @@ public class Monitor.GPUNvidia : IGPU, Object { public X.Display nvidia_display; construct { - // session_manager = get_sessman (); + // session_manager = get_sessman (); nvidia_display = new X.Display (); } @@ -45,7 +45,7 @@ public class Monitor.GPUNvidia : IGPU, Object { 0, NV_CTRL_GPU_CORE_TEMPERATURE, &nvidia_temperature - ); + ); if (!nvidia_resources_temperature) { warning ("Could not query NV_CTRL_GPU_CORE_TEMPERATURE attribute!\n"); @@ -59,11 +59,11 @@ public class Monitor.GPUNvidia : IGPU, Object { 0, NV_CTRL_USED_DEDICATED_GPU_MEMORY, &nvidia_memory_vram_used - ); + ); if (!nvidia_resources_vram_used) { warning ("Could not query NV_CTRL_USED_DEDICATED_GPU_MEMORY attribute!\n"); - return ; + return; } nvidia_resources_used = NVCtrl.XNVCTRLQueryTargetStringAttribute ( @@ -73,30 +73,39 @@ public class Monitor.GPUNvidia : IGPU, Object { 0, NV_CTRL_STRING_GPU_UTILIZATION, &nvidia_used - ); + ); // 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_percentage = int.parse (((string) nvidia_used).split_set ("=,")[1]); + nvidia_memory_percentage = int.parse (((string) nvidia_used).split_set ("=,")[3]); debug ("USED_GRAPHICS: %d%\n", nvidia_percentage); debug ("USED_MEMORY: %d%\n", nvidia_memory_percentage); if (!nvidia_resources_used) { warning ("Could not query NV_CTRL_STRING_GPU_UTILIZATION attribute!\n"); - return ; + return; } } - private void update_temperature () { temperature = nvidia_temperature; } + private void update_temperature () { + temperature = nvidia_temperature; + } - private void update_memory_vram_used () { memory_vram_used = (double) nvidia_memory_vram_used; } + private void update_memory_vram_used () { + memory_vram_used = (double) nvidia_memory_vram_used; + } - private void update_memory_vram_total () { } + private void update_memory_vram_total () { + } - private void update_memory_percentage () { memory_percentage = nvidia_memory_percentage; } + private void update_memory_percentage () { + memory_percentage = nvidia_memory_percentage; + } - private void update_percentage () { percentage = nvidia_percentage; } + private void update_percentage () { + percentage = nvidia_percentage; + } public void update () { update_nv_resources (); @@ -105,4 +114,5 @@ public class Monitor.GPUNvidia : IGPU, Object { update_memory_percentage (); update_percentage (); } + } diff --git a/src/Resources/GPU/IGPU.vala b/src/Resources/GPU/IGPU.vala index bccbfc67..82abe02a 100644 --- a/src/Resources/GPU/IGPU.vala +++ b/src/Resources/GPU/IGPU.vala @@ -1,5 +1,5 @@ public interface Monitor.IGPU : Object { - public abstract SessionManager? session_manager { get; public set; } + public abstract SessionManager ? session_manager { get; public set; } public abstract Gee.HashMap hwmon_temperatures { get; set; } @@ -44,4 +44,5 @@ public interface Monitor.IGPU : Object { } return content; } + }