mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
Improve startup performance of CpuMonitorPlugin
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user