github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/types/events.go (about) 1 package types 2 3 import ( 4 "github.com/opencontainers/runc/libcontainer/cgroups" 5 "github.com/opencontainers/runc/libcontainer/intelrdt" 6 ) 7 8 // Event struct for encoding the event data to json. 9 type Event struct { 10 Type string `json:"type"` 11 ID string `json:"id"` 12 Data interface{} `json:"data,omitempty"` 13 } 14 15 // stats is the runc specific stats structure for stability when encoding and decoding stats. 16 type Stats struct { 17 CPU Cpu `json:"cpu"` 18 CPUSet CPUSet `json:"cpuset"` 19 Memory Memory `json:"memory"` 20 Pids Pids `json:"pids"` 21 Blkio Blkio `json:"blkio"` 22 Hugetlb map[string]Hugetlb `json:"hugetlb"` 23 IntelRdt IntelRdt `json:"intel_rdt"` 24 NetworkInterfaces []*NetworkInterface `json:"network_interfaces"` 25 } 26 27 type PSIData = cgroups.PSIData 28 29 type PSIStats = cgroups.PSIStats 30 31 type Hugetlb struct { 32 Usage uint64 `json:"usage,omitempty"` 33 Max uint64 `json:"max,omitempty"` 34 Failcnt uint64 `json:"failcnt"` 35 } 36 37 type BlkioEntry struct { 38 Major uint64 `json:"major,omitempty"` 39 Minor uint64 `json:"minor,omitempty"` 40 Op string `json:"op,omitempty"` 41 Value uint64 `json:"value,omitempty"` 42 } 43 44 type Blkio struct { 45 IoServiceBytesRecursive []BlkioEntry `json:"ioServiceBytesRecursive,omitempty"` 46 IoServicedRecursive []BlkioEntry `json:"ioServicedRecursive,omitempty"` 47 IoQueuedRecursive []BlkioEntry `json:"ioQueueRecursive,omitempty"` 48 IoServiceTimeRecursive []BlkioEntry `json:"ioServiceTimeRecursive,omitempty"` 49 IoWaitTimeRecursive []BlkioEntry `json:"ioWaitTimeRecursive,omitempty"` 50 IoMergedRecursive []BlkioEntry `json:"ioMergedRecursive,omitempty"` 51 IoTimeRecursive []BlkioEntry `json:"ioTimeRecursive,omitempty"` 52 SectorsRecursive []BlkioEntry `json:"sectorsRecursive,omitempty"` 53 PSI *PSIStats `json:"psi,omitempty"` 54 } 55 56 type Pids struct { 57 Current uint64 `json:"current,omitempty"` 58 Limit uint64 `json:"limit,omitempty"` 59 } 60 61 type Throttling struct { 62 Periods uint64 `json:"periods,omitempty"` 63 ThrottledPeriods uint64 `json:"throttledPeriods,omitempty"` 64 ThrottledTime uint64 `json:"throttledTime,omitempty"` 65 } 66 67 type CpuUsage struct { 68 // Units: nanoseconds. 69 Total uint64 `json:"total,omitempty"` 70 Percpu []uint64 `json:"percpu,omitempty"` 71 PercpuKernel []uint64 `json:"percpu_kernel,omitempty"` 72 PercpuUser []uint64 `json:"percpu_user,omitempty"` 73 Kernel uint64 `json:"kernel"` 74 User uint64 `json:"user"` 75 } 76 77 type Cpu struct { 78 Usage CpuUsage `json:"usage,omitempty"` 79 Throttling Throttling `json:"throttling,omitempty"` 80 PSI *PSIStats `json:"psi,omitempty"` 81 } 82 83 type CPUSet struct { 84 CPUs []uint16 `json:"cpus,omitempty"` 85 CPUExclusive uint64 `json:"cpu_exclusive"` 86 Mems []uint16 `json:"mems,omitempty"` 87 MemHardwall uint64 `json:"mem_hardwall"` 88 MemExclusive uint64 `json:"mem_exclusive"` 89 MemoryMigrate uint64 `json:"memory_migrate"` 90 MemorySpreadPage uint64 `json:"memory_spread_page"` 91 MemorySpreadSlab uint64 `json:"memory_spread_slab"` 92 MemoryPressure uint64 `json:"memory_pressure"` 93 SchedLoadBalance uint64 `json:"sched_load_balance"` 94 SchedRelaxDomainLevel int64 `json:"sched_relax_domain_level"` 95 } 96 97 type MemoryEntry struct { 98 Limit uint64 `json:"limit"` 99 Usage uint64 `json:"usage,omitempty"` 100 Max uint64 `json:"max,omitempty"` 101 Failcnt uint64 `json:"failcnt"` 102 } 103 104 type Memory struct { 105 Cache uint64 `json:"cache,omitempty"` 106 Usage MemoryEntry `json:"usage,omitempty"` 107 Swap MemoryEntry `json:"swap,omitempty"` 108 Kernel MemoryEntry `json:"kernel,omitempty"` 109 KernelTCP MemoryEntry `json:"kernelTCP,omitempty"` 110 Raw map[string]uint64 `json:"raw,omitempty"` 111 PSI *PSIStats `json:"psi,omitempty"` 112 } 113 114 type L3CacheInfo struct { 115 CbmMask string `json:"cbm_mask,omitempty"` 116 MinCbmBits uint64 `json:"min_cbm_bits,omitempty"` 117 NumClosids uint64 `json:"num_closids,omitempty"` 118 } 119 120 type MemBwInfo struct { 121 BandwidthGran uint64 `json:"bandwidth_gran,omitempty"` 122 DelayLinear uint64 `json:"delay_linear,omitempty"` 123 MinBandwidth uint64 `json:"min_bandwidth,omitempty"` 124 NumClosids uint64 `json:"num_closids,omitempty"` 125 } 126 127 type IntelRdt struct { 128 // The read-only L3 cache information 129 L3CacheInfo *L3CacheInfo `json:"l3_cache_info,omitempty"` 130 131 // The read-only L3 cache schema in root 132 L3CacheSchemaRoot string `json:"l3_cache_schema_root,omitempty"` 133 134 // The L3 cache schema in 'container_id' group 135 L3CacheSchema string `json:"l3_cache_schema,omitempty"` 136 137 // The read-only memory bandwidth information 138 MemBwInfo *MemBwInfo `json:"mem_bw_info,omitempty"` 139 140 // The read-only memory bandwidth schema in root 141 MemBwSchemaRoot string `json:"mem_bw_schema_root,omitempty"` 142 143 // The memory bandwidth schema in 'container_id' group 144 MemBwSchema string `json:"mem_bw_schema,omitempty"` 145 146 // The memory bandwidth monitoring statistics from NUMA nodes in 'container_id' group 147 MBMStats *[]intelrdt.MBMNumaNodeStats `json:"mbm_stats,omitempty"` 148 149 // The cache monitoring technology statistics from NUMA nodes in 'container_id' group 150 CMTStats *[]intelrdt.CMTNumaNodeStats `json:"cmt_stats,omitempty"` 151 } 152 153 type NetworkInterface struct { 154 // Name is the name of the network interface. 155 Name string 156 157 RxBytes uint64 158 RxPackets uint64 159 RxErrors uint64 160 RxDropped uint64 161 TxBytes uint64 162 TxPackets uint64 163 TxErrors uint64 164 TxDropped uint64 165 }