Improve startup performance of CpuMonitorPlugin

This commit is contained in:
Stone_Red
2023-12-27 20:24:00 +01:00
parent 42c89823ce
commit 4a6b34775f
@@ -11,13 +11,17 @@ namespace DesktopMagic.BuiltInWindowElements;
internal class CpuMonitorPlugin : Plugin
{
private readonly PerformanceCounter cpuCounter = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total");
[Setting("usage-circle", "Show pie")]
private readonly CheckBox usageCircleCheckBox = new CheckBox(false);
private PerformanceCounter cpuCounter = null!;
public override int UpdateInterval => 1000;
public override void Start()
{
cpuCounter = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total");
}
public override Bitmap Main()
{
float cpuUsage = cpuCounter.NextValue();