Skip to content

Conversation

PHPGuus
Copy link

@PHPGuus PHPGuus commented Jul 27, 2022

On Linux systems, as used by Forge, the load average is a diminishing average calculation based on processes running, ready to run, waiting for IO and uninterruptable processes. For this reason, we cannot compute CPU load based on Load Average.

Instead, we should rebrand CPU Load to System Load, and introduce a new type of monitor: CPU Usage.

The proposed monitor uses /proc/stat to find the aggregated, kernel-written, CPU statistics for all cores in the system, basically calculates Idle Time as a percentage, and then uses that to derive the opposite value: CPU Usage. (This works intuitively the same way as what Windows OS does in the Task Manager).

Following changes are made:

  • Introduce stat:cpu command and monitor
  • Document stat:cpu and rebrand stat:cpu_load from "CPU Load" to "System Load"
  • Add CpuUsage model and table cpu_usage
  • Add CPU statistics class to sample and test the statistic

  + Introduce `stat:cpu` command and monitor
  + Document `stat:cpu`
  + Add CpuUsage model and table `cpu_usage`
  + Add CPU statistics class to sample and test the statistic
@taylorotwell taylorotwell requested a review from jbrooksuk July 28, 2022 14:10
@taylorotwell taylorotwell marked this pull request as draft July 28, 2022 14:10
@jbrooksuk
Copy link
Member

I'd like to get #35 merged first and then introduce additional monitors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants