getCpuLoad()

getCpuLoad()

Overview

The getCpuLoad() function retrieves the current CPU load on the system. It uses the systeminformation library to fetch the CPU load and returns the value as a percentage, rounded to two decimal places.

Usage

const cpuLoad = await monitoring.getCpuLoad();

Description

  • getCpuLoad() retrieves the current CPU load.

  • The result is returned as a string with two decimal places, representing the percentage of CPU load.

  • This function is asynchronous, so it returns a promise and should be used with await.

Use this function to monitor the CPU load in real-time or log the CPU status in your application.

Last updated