跳到主要内容

Monitor the load of a CPU

// We need to monitor the load of a CPU.
// Please implement a class that exposes two methods: record and average.
// The system will call `record` from time to time to pass in the current CPU load value;
// The maintainer will call `average` from time to time to get the average load in the past five minutes (if there is no `record` calling in the past five minutes, it should return -1).
// Please complete the following code.

class CPUMonitor {
constructor() {
}

record(value) {
}

average() {
}
}