SysMonitoring
  • Introduction
  • Installation
  • Configuration
  • Troubleshooting
  • Functions
    • startServer()
    • stopServer()
    • getCpuLoad()
    • getMemoryUsage()
    • getPing()
  • API
    • /cpu
    • /memory
    • /ping
  • Terminal Commands
    • echo
    • time
    • help
    • stats
Powered by GitBook
On this page
  • getCpuLoad()
  • Overview
  • Usage
  • Description
  1. Functions

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.

PreviousstopServer()NextgetMemoryUsage()

Last updated 5 months ago