2016-04-26 21:57:30 +00:00
|
|
|
package runtime
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Stat holds a container statistics
|
2016-04-26 21:57:30 +00:00
|
|
|
type Stat struct {
|
|
|
|
// Timestamp is the time that the statistics where collected
|
|
|
|
Timestamp time.Time
|
2016-06-03 22:00:49 +00:00
|
|
|
CPU CPU `json:"cpu"`
|
2016-04-26 21:57:30 +00:00
|
|
|
Memory Memory `json:"memory"`
|
|
|
|
Pids Pids `json:"pids"`
|
|
|
|
Blkio Blkio `json:"blkio"`
|
|
|
|
Hugetlb map[string]Hugetlb `json:"hugetlb"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Hugetlb holds information regarding a container huge tlb usage
|
2016-04-26 21:57:30 +00:00
|
|
|
type Hugetlb struct {
|
|
|
|
Usage uint64 `json:"usage,omitempty"`
|
|
|
|
Max uint64 `json:"max,omitempty"`
|
|
|
|
Failcnt uint64 `json:"failcnt"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// BlkioEntry represents a single record for a Blkio stat
|
2016-04-26 21:57:30 +00:00
|
|
|
type BlkioEntry struct {
|
|
|
|
Major uint64 `json:"major,omitempty"`
|
|
|
|
Minor uint64 `json:"minor,omitempty"`
|
|
|
|
Op string `json:"op,omitempty"`
|
|
|
|
Value uint64 `json:"value,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Blkio regroups all the Blkio related stats
|
2016-04-26 21:57:30 +00:00
|
|
|
type Blkio struct {
|
|
|
|
IoServiceBytesRecursive []BlkioEntry `json:"ioServiceBytesRecursive,omitempty"`
|
|
|
|
IoServicedRecursive []BlkioEntry `json:"ioServicedRecursive,omitempty"`
|
|
|
|
IoQueuedRecursive []BlkioEntry `json:"ioQueueRecursive,omitempty"`
|
|
|
|
IoServiceTimeRecursive []BlkioEntry `json:"ioServiceTimeRecursive,omitempty"`
|
|
|
|
IoWaitTimeRecursive []BlkioEntry `json:"ioWaitTimeRecursive,omitempty"`
|
|
|
|
IoMergedRecursive []BlkioEntry `json:"ioMergedRecursive,omitempty"`
|
|
|
|
IoTimeRecursive []BlkioEntry `json:"ioTimeRecursive,omitempty"`
|
|
|
|
SectorsRecursive []BlkioEntry `json:"sectorsRecursive,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Pids holds the stat of the pid usage of the machine
|
2016-04-26 21:57:30 +00:00
|
|
|
type Pids struct {
|
|
|
|
Current uint64 `json:"current,omitempty"`
|
|
|
|
Limit uint64 `json:"limit,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Throttling holds a cpu throttling information
|
2016-04-26 21:57:30 +00:00
|
|
|
type Throttling struct {
|
|
|
|
Periods uint64 `json:"periods,omitempty"`
|
|
|
|
ThrottledPeriods uint64 `json:"throttledPeriods,omitempty"`
|
|
|
|
ThrottledTime uint64 `json:"throttledTime,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// CPUUsage holds information regarding cpu usage
|
|
|
|
type CPUUsage struct {
|
2016-04-26 21:57:30 +00:00
|
|
|
// Units: nanoseconds.
|
|
|
|
Total uint64 `json:"total,omitempty"`
|
|
|
|
Percpu []uint64 `json:"percpu,omitempty"`
|
|
|
|
Kernel uint64 `json:"kernel"`
|
|
|
|
User uint64 `json:"user"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// CPU regroups both a CPU usage and throttling information
|
|
|
|
type CPU struct {
|
|
|
|
Usage CPUUsage `json:"usage,omitempty"`
|
2016-04-26 21:57:30 +00:00
|
|
|
Throttling Throttling `json:"throttling,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// MemoryEntry regroups statistic about a given type of memory
|
2016-04-26 21:57:30 +00:00
|
|
|
type MemoryEntry struct {
|
|
|
|
Limit uint64 `json:"limit"`
|
|
|
|
Usage uint64 `json:"usage,omitempty"`
|
|
|
|
Max uint64 `json:"max,omitempty"`
|
|
|
|
Failcnt uint64 `json:"failcnt"`
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// Memory holds information regarding the different type of memories available
|
2016-04-26 21:57:30 +00:00
|
|
|
type Memory struct {
|
|
|
|
Cache uint64 `json:"cache,omitempty"`
|
|
|
|
Usage MemoryEntry `json:"usage,omitempty"`
|
|
|
|
Swap MemoryEntry `json:"swap,omitempty"`
|
|
|
|
Kernel MemoryEntry `json:"kernel,omitempty"`
|
|
|
|
KernelTCP MemoryEntry `json:"kernelTCP,omitempty"`
|
|
|
|
Raw map[string]uint64 `json:"raw,omitempty"`
|
|
|
|
}
|