Skip to content

Commit

Permalink
add cpu/gpu basic status report in logs at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 15, 2024
1 parent 45da8dc commit df15257
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Core/Program.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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...");
Expand Down

0 comments on commit df15257

Please sign in to comment.