Fonctions computemin and computemax added
This commit is contained in:
parent
6f8fa96150
commit
ccb508705b
@ -36,6 +36,13 @@ function computeCpuMean (cpus) {
|
|||||||
|
|
||||||
function computeMax (values) {
|
function computeMax (values) {
|
||||||
// TODO
|
// TODO
|
||||||
|
let max = -Infinity
|
||||||
|
for (let i = 0; i < values.length; i++) {
|
||||||
|
if (values > max) {
|
||||||
|
max = values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max
|
||||||
}
|
}
|
||||||
|
|
||||||
function computeCpuMax (cpus) {
|
function computeCpuMax (cpus) {
|
||||||
@ -44,27 +51,30 @@ function computeCpuMax (cpus) {
|
|||||||
|
|
||||||
function computeMin (values) {
|
function computeMin (values) {
|
||||||
// TODO
|
// TODO
|
||||||
|
let min = +Infinity
|
||||||
|
for (let i = 0; i < values.length; i++) {
|
||||||
|
if (values < min) {
|
||||||
|
min = values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
function computeCpuMin (cpus) {
|
function computeCpuMin (cpus) {
|
||||||
|
return computeMin(cpus.map(computeMin))
|
||||||
// TODO: rebase on top of computeMin()
|
// TODO: rebase on top of computeMin()
|
||||||
|
// let min = +Infinity
|
||||||
let min = +Infinity
|
// for (let i = 0; i < cpus.length; i++) {
|
||||||
|
// const valuesByDay = cpus[i]
|
||||||
for (let i = 0; i < cpus.length; i++) {
|
// for (let j = 0; j < valuesByDay.length; j++) {
|
||||||
const valuesByDay = cpus[i]
|
// const value = valuesByDay[j]
|
||||||
|
// if (value < min) {
|
||||||
for (let j = 0; j < valuesByDay.length; j++) {
|
// min = value
|
||||||
const value = valuesByDay[j]
|
// }
|
||||||
|
// }
|
||||||
if (value < min) {
|
// }
|
||||||
min = value
|
// return min
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return min
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -79,8 +89,6 @@ class UsageReportPlugin {
|
|||||||
this.mailsReceivers = emails
|
this.mailsReceivers = emails
|
||||||
}
|
}
|
||||||
load () {
|
load () {
|
||||||
// TODO
|
|
||||||
// pour hours enlever les null
|
|
||||||
let parsedHostDaysLab1 = require('/home/thannos/xo-server/lab1_days.json')
|
let parsedHostDaysLab1 = require('/home/thannos/xo-server/lab1_days.json')
|
||||||
let parsedHostHoursLab1 = require('/home/thannos/xo-server/lab1_hours.json')
|
let parsedHostHoursLab1 = require('/home/thannos/xo-server/lab1_hours.json')
|
||||||
let parsedHostDaysLab2 = require('/home/thannos/xo-server/lab2_days.json')
|
let parsedHostDaysLab2 = require('/home/thannos/xo-server/lab2_days.json')
|
||||||
|
Loading…
Reference in New Issue
Block a user