-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.go
50 lines (41 loc) · 915 Bytes
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package scheduler
import (
"io"
"time"
libprober "github.com/Cloud-Foundations/health-agent/lib/prober"
"github.com/Cloud-Foundations/tricorder/go/tricorder"
)
type loadAverage struct {
oneMinute float32
fiveMinutes float32
fifteenMinutes float32
}
type timeMetric struct {
value time.Duration
fraction float64
}
type cpuStatistics struct {
lastProbeTime time.Time
idleTime timeMetric
iOWaitTime timeMetric
irqTime timeMetric
userNiceTime timeMetric
softIrqTime timeMetric
systemTime timeMetric
userTime timeMetric
}
type prober struct {
loadavg loadAverage
numCpus uint64
cpuStats cpuStatistics
lastCpuStats cpuStatistics
}
func Register(dir *tricorder.DirectorySpec) libprober.Prober {
return register(dir)
}
func (p *prober) Probe() error {
return p.probe()
}
func (p *prober) WriteHtml(writer io.Writer) {
p.writeHtml(writer)
}