Utilities | shell-parse | uuid | Search

usage

system usage report

The systemUsage function monitors system CPU usage and memory usage over time, calculating and returning the average percentage usage in an object format. It measures CPU usage at regular intervals, calculates the average CPU usage, and stores memory usage data in an object.

system usage graph

The code uses the D3.js library to create a graph that displays system usage data over time, with the option to use a fallback data source if the primary data is missing. The graph is customized with a color palette and axis labels, and it displays a line for each group in the data.

system usage png buffer

The code requires dependencies on fs, path, os, and child_process to interact with the file system, work with file paths, and execute system commands. The systemBuffer function generates a graph usage PNG image from a given data parameter, writing and converting an SVG to a PNG before returning the PNG image as a buffer.