diff --git a/Moonlight/App/Helpers/HostSystemHelper.cs b/Moonlight/App/Helpers/HostSystemHelper.cs index 344bed5..57df6d7 100644 --- a/Moonlight/App/Helpers/HostSystemHelper.cs +++ b/Moonlight/App/Helpers/HostSystemHelper.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System.Diagnostics; +using System.Runtime.InteropServices; using Logging.Net; namespace Moonlight.App.Helpers; @@ -45,4 +46,19 @@ public class HostSystemHelper return "N/A"; } } + + public int GetMemoryUsage() + { + var process = Process.GetCurrentProcess(); + var bytes = process.WorkingSet64; + return (int)(bytes / (1024.0 * 1024.0)); + } + + public int GetCpuUsage() + { + var process = Process.GetCurrentProcess(); + var cpuTime = process.TotalProcessorTime; + var wallClockTime = DateTime.UtcNow - process.StartTime.ToUniversalTime(); + return (int)(100.0 * cpuTime.TotalMilliseconds / wallClockTime.TotalMilliseconds / Environment.ProcessorCount); + } } \ No newline at end of file diff --git a/Moonlight/Shared/Views/Admin/Sys/Index.razor b/Moonlight/Shared/Views/Admin/Sys/Index.razor index fc10ea0..f740a7e 100644 --- a/Moonlight/Shared/Views/Admin/Sys/Index.razor +++ b/Moonlight/Shared/Views/Admin/Sys/Index.razor @@ -9,7 +9,7 @@
-
+
@@ -24,7 +24,7 @@
-
+
@@ -39,5 +39,36 @@
+
+
+
+ + Memory usage + +
+
+ + Moonlight is using + @(HostSystemHelper.GetMemoryUsage()) MB + of memory + +
+
+
+
+
+
+ + Cpu usage + +
+
+ + Moonlight is using + @(HostSystemHelper.GetCpuUsage()) % + +
+
+
\ No newline at end of file diff --git a/Moonlight/resources/lang/de_de.lang b/Moonlight/resources/lang/de_de.lang index afa1303..df3125a 100644 --- a/Moonlight/resources/lang/de_de.lang +++ b/Moonlight/resources/lang/de_de.lang @@ -274,3 +274,7 @@ Version;Version You are running moonlight version;You are running moonlight version Operating system;Operating system Moonlight is running on;Moonlight is running on +Memory usage;Memory usage +Moonlight is using;Moonlight is using +of memory;of memory +Cpu usage;Cpu usage