Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RunCat/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public RunCatApplicationContext()

SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(UserPreferenceChanged);

cpuUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
cpuUsage = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total");
_ = cpuUsage.NextValue(); // discards first return value

runnerMenu = new ToolStripMenuItem("Runner", null, new ToolStripMenuItem[]
Expand Down Expand Up @@ -365,7 +365,7 @@ private void CPUTickSpeed()

private void CPUTick()
{
interval = cpuUsage.NextValue();
interval = Math.Min(100, cpuUsage.NextValue()); // Sometimes got over 100% so it should be limited to 100%
notifyIcon.Text = $"CPU: {interval:f1}%";
interval = 200.0f / (float)Math.Max(1.0f, Math.Min(20.0f, interval / 5.0f));
_ = interval;
Expand Down