aboutsummaryrefslogtreecommitdiff
path: root/src/tasks/cpuUsage.ts
blob: f456c31216b23a9257732417f51dce4c7abf6596 (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 async exec() {
		const cpuStats = await osu.cpu.usage(this.client.stats.cpu === undefined ? 100 * Time.Millisecond : Time.Minute);
		this.client.stats.cpu = cpuStats;
	}
}