1 package cgroups
2
3 type ThrottlingData struct {
4
5 Periods uint64 `json:"periods,omitempty"`
6
7 ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`
8
9 ThrottledTime uint64 `json:"throttled_time,omitempty"`
10 }
11
12
13
14 type CpuUsage struct {
15
16
17 TotalUsage uint64 `json:"total_usage,omitempty"`
18
19
20 PercpuUsage []uint64 `json:"percpu_usage,omitempty"`
21
22
23 PercpuUsageInKernelmode []uint64 `json:"percpu_usage_in_kernelmode"`
24
25
26 PercpuUsageInUsermode []uint64 `json:"percpu_usage_in_usermode"`
27
28
29 UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
30
31
32 UsageInUsermode uint64 `json:"usage_in_usermode"`
33 }
34
35 type CpuStats struct {
36 CpuUsage CpuUsage `json:"cpu_usage,omitempty"`
37 ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
38 }
39
40 type CPUSetStats struct {
41
42
43 CPUs []uint16 `json:"cpus,omitempty"`
44
45 CPUExclusive uint64 `json:"cpu_exclusive"`
46
47
48 Mems []uint16 `json:"mems,omitempty"`
49
50 MemHardwall uint64 `json:"mem_hardwall"`
51
52 MemExclusive uint64 `json:"mem_exclusive"`
53
54 MemoryMigrate uint64 `json:"memory_migrate"`
55
56 MemorySpreadPage uint64 `json:"memory_spread_page"`
57
58 MemorySpreadSlab uint64 `json:"memory_spread_slab"`
59
60 MemoryPressure uint64 `json:"memory_pressure"`
61
62 SchedLoadBalance uint64 `json:"sched_load_balance"`
63
64 SchedRelaxDomainLevel int64 `json:"sched_relax_domain_level"`
65 }
66
67 type MemoryData struct {
68 Usage uint64 `json:"usage,omitempty"`
69 MaxUsage uint64 `json:"max_usage,omitempty"`
70 Failcnt uint64 `json:"failcnt"`
71 Limit uint64 `json:"limit"`
72 }
73
74 type MemoryStats struct {
75
76 Cache uint64 `json:"cache,omitempty"`
77
78 Usage MemoryData `json:"usage,omitempty"`
79
80 SwapUsage MemoryData `json:"swap_usage,omitempty"`
81
82 SwapOnlyUsage MemoryData `json:"swap_only_usage,omitempty"`
83
84 KernelUsage MemoryData `json:"kernel_usage,omitempty"`
85
86 KernelTCPUsage MemoryData `json:"kernel_tcp_usage,omitempty"`
87
88
89 PageUsageByNUMA PageUsageByNUMA `json:"page_usage_by_numa,omitempty"`
90
91 UseHierarchy bool `json:"use_hierarchy"`
92
93 Stats map[string]uint64 `json:"stats,omitempty"`
94 }
95
96 type PageUsageByNUMA struct {
97
98 PageUsageByNUMAInner
99 Hierarchical PageUsageByNUMAInner `json:"hierarchical,omitempty"`
100 }
101
102 type PageUsageByNUMAInner struct {
103 Total PageStats `json:"total,omitempty"`
104 File PageStats `json:"file,omitempty"`
105 Anon PageStats `json:"anon,omitempty"`
106 Unevictable PageStats `json:"unevictable,omitempty"`
107 }
108
109 type PageStats struct {
110 Total uint64 `json:"total,omitempty"`
111 Nodes map[uint8]uint64 `json:"nodes,omitempty"`
112 }
113
114 type PidsStats struct {
115
116 Current uint64 `json:"current,omitempty"`
117
118 Limit uint64 `json:"limit,omitempty"`
119 }
120
121 type BlkioStatEntry struct {
122 Major uint64 `json:"major,omitempty"`
123 Minor uint64 `json:"minor,omitempty"`
124 Op string `json:"op,omitempty"`
125 Value uint64 `json:"value,omitempty"`
126 }
127
128 type BlkioStats struct {
129
130 IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitempty"`
131 IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive,omitempty"`
132 IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitempty"`
133 IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitempty"`
134 IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitempty"`
135 IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitempty"`
136 IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty"`
137 SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty"`
138 }
139
140 type HugetlbStats struct {
141
142 Usage uint64 `json:"usage,omitempty"`
143
144 MaxUsage uint64 `json:"max_usage,omitempty"`
145
146 Failcnt uint64 `json:"failcnt"`
147 }
148
149 type RdmaEntry struct {
150 Device string `json:"device,omitempty"`
151 HcaHandles uint32 `json:"hca_handles,omitempty"`
152 HcaObjects uint32 `json:"hca_objects,omitempty"`
153 }
154
155 type RdmaStats struct {
156 RdmaLimit []RdmaEntry `json:"rdma_limit,omitempty"`
157 RdmaCurrent []RdmaEntry `json:"rdma_current,omitempty"`
158 }
159
160 type Stats struct {
161 CpuStats CpuStats `json:"cpu_stats,omitempty"`
162 CPUSetStats CPUSetStats `json:"cpuset_stats,omitempty"`
163 MemoryStats MemoryStats `json:"memory_stats,omitempty"`
164 PidsStats PidsStats `json:"pids_stats,omitempty"`
165 BlkioStats BlkioStats `json:"blkio_stats,omitempty"`
166
167 HugetlbStats map[string]HugetlbStats `json:"hugetlb_stats,omitempty"`
168 RdmaStats RdmaStats `json:"rdma_stats,omitempty"`
169 }
170
171 func NewStats() *Stats {
172 memoryStats := MemoryStats{Stats: make(map[string]uint64)}
173 hugetlbStats := make(map[string]HugetlbStats)
174 return &Stats{MemoryStats: memoryStats, HugetlbStats: hugetlbStats}
175 }
176
View as plain text