lup-system
Version:
NodeJS library to retrieve system information and utilization.
47 lines (46 loc) • 1.52 kB
TypeScript
export type CPUUtilization = {
/** Overall CPU utilization as a percentage (0.0-1.0). */
overall: number;
/** Utilization of each CPU core as a percentage (0.0-1.0). */
cores: number[];
};
export type CPU = {
/** Name of the CPU. */
name: string;
/** Number of CPU cores. */
coreCount: number;
/** CPU architecture (e.g., x64, arm64). */
architecture: string;
/** Endianness of the CPU (e.g., LE for little-endian, BE for big-endian). */
endian: 'LE' | 'BE';
/** CPU speed in MHz. */
speed: number;
/** CPU utilization data. */
utilization: CPUUtilization;
};
/** Intervall in milliseconds at which CPU utilization is computed. */
export declare let CPU_COMPUTE_UTILIZATION_INTERVAL: number;
/**
* Stops the computation of CPU utilization.
* As soon as one of the getCpu*Utilization functions is called again, the computation will be restarted.
*/
export declare function stopCpuUtilizationComputation(): void;
/**
* Returns information about the CPU.
*
* @returns CPU information.
*/
export declare function getCpuInfo(): Promise<CPU>;
/**
* Returns the current CPU utilization.
* If the computation is not running, it will start the computation and return the initial values.
*
* @returns CPU utilization data.
*/
export declare function getCpuUtilization(): Promise<CPUUtilization>;
/**
* Returns the number of CPU cores available on the system.
*
* @returns Number of CPU cores.
*/
export declare function getCpuCoreCount(): number;