Skip to content

Change the cpu-usage EventCounter from int to double #62525

@Tomius

Description

@Tomius

In the following line:

_cpuTimeCounter ??= new PollingCounter("cpu-usage", this, () => RuntimeEventSourceHelper.GetCpuUsage()) { DisplayName = "CPU Usage", DisplayUnits = "%" };

The RuntimeEventSourceHelper.GetCpuUsage() returns an integer percent of all system resources used.

This means that on a machine with 128 cores, the smallest detectable change in CPU usage will be 128% of a single core, so a single threaded busy-loop application will report to be using 0% CPU according to this counter, when it's actually burning an entire core. This is very misleading.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions