aboutsummaryrefslogtreecommitdiff
path: root/src/tasks/cpuUsage.ts
blob: e5cfc00f8c402aab72f5309b414261092474ce1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { BushTask, Time } from '#lib';
import osu from 'node-os-utils';

export default class CpuUsageTask extends BushTask {
	public constructor() {
		super('cpuUsage', {
			delay: Time.Minute,
			runOnStart: true
		});
	}

	public override async exec() {
		const cpu = await osu.cpu.usage(client.stats.cpu === undefined ? 100 * Time.Millisecond : Time.Minute);
		client.stats.cpu = cpu;
	}
}