From df152579974d4a1f39cfe8ebad1310865676b9f8 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Sat, 15 Jun 2024 00:45:10 -0700 Subject: [PATCH] add cpu/gpu basic status report in logs at startup --- src/Core/Program.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Core/Program.cs b/src/Core/Program.cs index 7f45cd58..082cce94 100644 --- a/src/Core/Program.cs +++ b/src/Core/Program.cs @@ -1,6 +1,7 @@ using FreneticUtilities.FreneticDataSyntax; using FreneticUtilities.FreneticExtensions; using FreneticUtilities.FreneticToolkit; +using Hardware.Info; using LiteDB; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -162,6 +163,21 @@ public static void Main(string[] args) CurrentGitDate = "Git failed to load"; } })); + waitFor.Add(Utilities.RunCheckedTask(async () => + { + NvidiaUtil.NvidiaInfo[] gpuInfo = NvidiaUtil.QueryNvidia(); + SystemStatusMonitor.HardwareInfo.RefreshMemoryStatus(); + MemoryStatus memStatus = SystemStatusMonitor.HardwareInfo.MemoryStatus; + Logs.Init($"CPU Cores: {Environment.ProcessorCount} | RAM: {new MemoryNum((long)memStatus.TotalPhysical)} total, {new MemoryNum((long)memStatus.AvailablePhysical)} available"); + if (gpuInfo is not null) + { + JObject gpus = []; + foreach (NvidiaUtil.NvidiaInfo gpu in gpuInfo) + { + Logs.Init($"GPU {gpu.ID}: {gpu.GPUName} | Temp {gpu.Temperature}C | Util {gpu.UtilizationGPU}% GPU, {gpu.UtilizationMemory}% Memory | VRAM {gpu.TotalMemory} total, {gpu.FreeMemory} free, {gpu.UsedMemory} used"); + } + } + })); RunOnAllExtensions(e => e.OnPreInit()); timer.Check("Extension PreInit"); Logs.Init("Prepping options...");