Skip to content

Commit 6a3326b

Browse files
committed
support psi
Signed-off-by: zouyee <zouyee1989@gmail.com>
1 parent a0ae1c2 commit 6a3326b

6 files changed

Lines changed: 603 additions & 239 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ cgutil:
2323
proto:
2424
protobuild --quiet ${PACKAGES}
2525
# Keep them Go-idiomatic and backward-compatible with the gogo/protobuf era.
26-
go-fix-acronym -w -a '(Cpu|Tcp|Rss)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go')
26+
go-fix-acronym -w -a '(Cpu|Tcp|Rss|Psi)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go')

cgroup2/manager.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
559559
NrPeriods: out["nr_periods"],
560560
NrThrottled: out["nr_throttled"],
561561
ThrottledUsec: out["throttled_usec"],
562+
PSI: getStatPSIFromFile(filepath.Join(c.path, "cpu.pressure")),
562563
}
563564
metrics.Memory = &stats.MemoryStat{
564565
Anon: out["anon"],
@@ -596,6 +597,7 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
596597
UsageLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.max")),
597598
SwapUsage: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.current")),
598599
SwapLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.max")),
600+
PSI: getStatPSIFromFile(filepath.Join(c.path, "memory.pressure")),
599601
}
600602
if len(memoryEvents) > 0 {
601603
metrics.MemoryEvents = &stats.MemoryEvents{
@@ -606,7 +608,10 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
606608
OomKill: memoryEvents["oom_kill"],
607609
}
608610
}
609-
metrics.Io = &stats.IOStat{Usage: readIoStats(c.path)}
611+
metrics.Io = &stats.IOStat{
612+
Usage: readIoStats(c.path),
613+
PSI: getStatPSIFromFile(filepath.Join(c.path, "io.pressure")),
614+
}
610615
metrics.Rdma = &stats.RdmaStat{
611616
Current: rdmaStats(filepath.Join(c.path, "rdma.current")),
612617
Limit: rdmaStats(filepath.Join(c.path, "rdma.max")),

0 commit comments

Comments
 (0)