Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Sources/Containerization/ContainerStatistics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public struct ContainerStatistics: Sendable {
public var majorPageFaults: UInt64
public var inactiveFile: UInt64
public var anon: UInt64
public var workingsetRefaultAnon: UInt64
public var workingsetRefaultFile: UInt64
public var pgstealKswapd: UInt64
public var pgstealDirect: UInt64
public var pgstealKhugepaged: UInt64

public init(
usageBytes: UInt64,
Expand All @@ -78,7 +83,12 @@ public struct ContainerStatistics: Sendable {
pageFaults: UInt64,
majorPageFaults: UInt64,
inactiveFile: UInt64,
anon: UInt64
anon: UInt64,
workingsetRefaultAnon: UInt64 = 0,
workingsetRefaultFile: UInt64 = 0,
pgstealKswapd: UInt64 = 0,
pgstealDirect: UInt64 = 0,
pgstealKhugepaged: UInt64 = 0
) {
self.usageBytes = usageBytes
self.limitBytes = limitBytes
Expand All @@ -91,6 +101,11 @@ public struct ContainerStatistics: Sendable {
self.majorPageFaults = majorPageFaults
self.inactiveFile = inactiveFile
self.anon = anon
self.workingsetRefaultAnon = workingsetRefaultAnon
self.workingsetRefaultFile = workingsetRefaultFile
self.pgstealKswapd = pgstealKswapd
self.pgstealDirect = pgstealDirect
self.pgstealKhugepaged = pgstealKhugepaged
}
}

Expand Down
37 changes: 36 additions & 1 deletion Sources/Containerization/SandboxContext/SandboxContext.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,16 @@ public struct Com_Apple_Containerization_Sandbox_V3_MemoryStats: Sendable {

public var anon: UInt64 = 0

public var workingsetRefaultAnon: UInt64 = 0

public var workingsetRefaultFile: UInt64 = 0

public var pgstealKswapd: UInt64 = 0

public var pgstealDirect: UInt64 = 0

public var pgstealKhugepaged: UInt64 = 0

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
Expand Down Expand Up @@ -3855,7 +3865,7 @@ extension Com_Apple_Containerization_Sandbox_V3_ProcessStats: SwiftProtobuf.Mess

extension Com_Apple_Containerization_Sandbox_V3_MemoryStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".MemoryStats"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}usage_bytes\0\u{3}limit_bytes\0\u{3}swap_usage_bytes\0\u{3}swap_limit_bytes\0\u{3}cache_bytes\0\u{3}kernel_stack_bytes\0\u{3}slab_bytes\0\u{3}page_faults\0\u{3}major_page_faults\0\u{3}inactive_file\0\u{1}anon\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}usage_bytes\0\u{3}limit_bytes\0\u{3}swap_usage_bytes\0\u{3}swap_limit_bytes\0\u{3}cache_bytes\0\u{3}kernel_stack_bytes\0\u{3}slab_bytes\0\u{3}page_faults\0\u{3}major_page_faults\0\u{3}inactive_file\0\u{1}anon\0\u{3}workingset_refault_anon\0\u{3}workingset_refault_file\0\u{3}pgsteal_kswapd\0\u{3}pgsteal_direct\0\u{3}pgsteal_khugepaged\0")

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
Expand All @@ -3874,6 +3884,11 @@ extension Com_Apple_Containerization_Sandbox_V3_MemoryStats: SwiftProtobuf.Messa
case 9: try { try decoder.decodeSingularUInt64Field(value: &self.majorPageFaults) }()
case 10: try { try decoder.decodeSingularUInt64Field(value: &self.inactiveFile) }()
case 11: try { try decoder.decodeSingularUInt64Field(value: &self.anon) }()
case 12: try { try decoder.decodeSingularUInt64Field(value: &self.workingsetRefaultAnon) }()
case 13: try { try decoder.decodeSingularUInt64Field(value: &self.workingsetRefaultFile) }()
case 14: try { try decoder.decodeSingularUInt64Field(value: &self.pgstealKswapd) }()
case 15: try { try decoder.decodeSingularUInt64Field(value: &self.pgstealDirect) }()
case 16: try { try decoder.decodeSingularUInt64Field(value: &self.pgstealKhugepaged) }()
default: break
}
}
Expand Down Expand Up @@ -3913,6 +3928,21 @@ extension Com_Apple_Containerization_Sandbox_V3_MemoryStats: SwiftProtobuf.Messa
if self.anon != 0 {
try visitor.visitSingularUInt64Field(value: self.anon, fieldNumber: 11)
}
if self.workingsetRefaultAnon != 0 {
try visitor.visitSingularUInt64Field(value: self.workingsetRefaultAnon, fieldNumber: 12)
}
if self.workingsetRefaultFile != 0 {
try visitor.visitSingularUInt64Field(value: self.workingsetRefaultFile, fieldNumber: 13)
}
if self.pgstealKswapd != 0 {
try visitor.visitSingularUInt64Field(value: self.pgstealKswapd, fieldNumber: 14)
}
if self.pgstealDirect != 0 {
try visitor.visitSingularUInt64Field(value: self.pgstealDirect, fieldNumber: 15)
}
if self.pgstealKhugepaged != 0 {
try visitor.visitSingularUInt64Field(value: self.pgstealKhugepaged, fieldNumber: 16)
}
try unknownFields.traverse(visitor: &visitor)
}

Expand All @@ -3928,6 +3958,11 @@ extension Com_Apple_Containerization_Sandbox_V3_MemoryStats: SwiftProtobuf.Messa
if lhs.majorPageFaults != rhs.majorPageFaults {return false}
if lhs.inactiveFile != rhs.inactiveFile {return false}
if lhs.anon != rhs.anon {return false}
if lhs.workingsetRefaultAnon != rhs.workingsetRefaultAnon {return false}
if lhs.workingsetRefaultFile != rhs.workingsetRefaultFile {return false}
if lhs.pgstealKswapd != rhs.pgstealKswapd {return false}
if lhs.pgstealDirect != rhs.pgstealDirect {return false}
if lhs.pgstealKhugepaged != rhs.pgstealKhugepaged {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
Expand Down
5 changes: 5 additions & 0 deletions Sources/Containerization/SandboxContext/SandboxContext.proto
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ message MemoryStats {
uint64 major_page_faults = 9;
uint64 inactive_file = 10;
uint64 anon = 11;
uint64 workingset_refault_anon = 12;
uint64 workingset_refault_file = 13;
uint64 pgsteal_kswapd = 14;
uint64 pgsteal_direct = 15;
uint64 pgsteal_khugepaged = 16;
}

message CPUStats {
Expand Down
7 changes: 6 additions & 1 deletion Sources/Containerization/Vminitd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ extension Vminitd: VirtualMachineAgent {
pageFaults: protoStats.memory.pageFaults,
majorPageFaults: protoStats.memory.majorPageFaults,
inactiveFile: protoStats.memory.inactiveFile,
anon: protoStats.memory.anon
anon: protoStats.memory.anon,
workingsetRefaultAnon: protoStats.memory.workingsetRefaultAnon,
workingsetRefaultFile: protoStats.memory.workingsetRefaultFile,
pgstealKswapd: protoStats.memory.pgstealKswapd,
pgstealDirect: protoStats.memory.pgstealDirect,
pgstealKhugepaged: protoStats.memory.pgstealKhugepaged
) : nil,
cpu: categories.contains(.cpu) && protoStats.hasCpu
? .init(
Expand Down
25 changes: 21 additions & 4 deletions vminitd/Sources/Cgroup/Cgroup2Manager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,13 @@ public struct Cgroup2Manager: Sendable {
fileWriteback: statValues["file_writeback"] ?? 0,
pgfault: statValues["pgfault"] ?? 0,
pgmajfault: statValues["pgmajfault"] ?? 0,
workingsetRefault: statValues["workingset_refault"] ?? 0,
workingsetRefaultAnon: statValues["workingset_refault_anon"] ?? 0,
workingsetRefaultFile: statValues["workingset_refault_file"] ?? 0,
workingsetActivate: statValues["workingset_activate"] ?? 0,
workingsetNodereclaim: statValues["workingset_nodereclaim"] ?? 0,
pgstealKswapd: statValues["pgsteal_kswapd"] ?? 0,
pgstealDirect: statValues["pgsteal_direct"] ?? 0,
pgstealKhugepaged: statValues["pgsteal_khugepaged"] ?? 0,
inactiveAnon: statValues["inactive_anon"] ?? 0,
activeAnon: statValues["active_anon"] ?? 0,
inactiveFile: statValues["inactive_file"] ?? 0,
Expand Down Expand Up @@ -573,10 +577,15 @@ package struct MemoryStats: Sendable {
package var pgfault: UInt64
package var pgmajfault: UInt64

package var workingsetRefault: UInt64
package var workingsetRefaultAnon: UInt64
package var workingsetRefaultFile: UInt64
package var workingsetActivate: UInt64
package var workingsetNodereclaim: UInt64

package var pgstealKswapd: UInt64
package var pgstealDirect: UInt64
package var pgstealKhugepaged: UInt64

package var inactiveAnon: UInt64
package var activeAnon: UInt64
package var inactiveFile: UInt64
Expand All @@ -598,9 +607,13 @@ package struct MemoryStats: Sendable {
fileWriteback: UInt64 = 0,
pgfault: UInt64 = 0,
pgmajfault: UInt64 = 0,
workingsetRefault: UInt64 = 0,
workingsetRefaultAnon: UInt64 = 0,
workingsetRefaultFile: UInt64 = 0,
workingsetActivate: UInt64 = 0,
workingsetNodereclaim: UInt64 = 0,
pgstealKswapd: UInt64 = 0,
pgstealDirect: UInt64 = 0,
pgstealKhugepaged: UInt64 = 0,
inactiveAnon: UInt64 = 0,
activeAnon: UInt64 = 0,
inactiveFile: UInt64 = 0,
Expand All @@ -621,9 +634,13 @@ package struct MemoryStats: Sendable {
self.fileWriteback = fileWriteback
self.pgfault = pgfault
self.pgmajfault = pgmajfault
self.workingsetRefault = workingsetRefault
self.workingsetRefaultAnon = workingsetRefaultAnon
self.workingsetRefaultFile = workingsetRefaultFile
self.workingsetActivate = workingsetActivate
self.workingsetNodereclaim = workingsetNodereclaim
self.pgstealKswapd = pgstealKswapd
self.pgstealDirect = pgstealDirect
self.pgstealKhugepaged = pgstealKhugepaged
self.inactiveAnon = inactiveAnon
self.activeAnon = activeAnon
self.inactiveFile = inactiveFile
Expand Down
5 changes: 5 additions & 0 deletions vminitd/Sources/VminitdCore/Server+GRPC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,11 @@ extension Initd: Com_Apple_Containerization_Sandbox_V3_SandboxContext.SimpleServ
$0.majorPageFaults = memory.pgmajfault
$0.inactiveFile = memory.inactiveFile
$0.anon = memory.anon
$0.workingsetRefaultAnon = memory.workingsetRefaultAnon
$0.workingsetRefaultFile = memory.workingsetRefaultFile
$0.pgstealKswapd = memory.pgstealKswapd
$0.pgstealDirect = memory.pgstealDirect
$0.pgstealKhugepaged = memory.pgstealKhugepaged
}
}

Expand Down
Loading