Skip to content

Commit

Permalink
support psi
Browse files Browse the repository at this point in the history
Signed-off-by: zouyee <[email protected]>
  • Loading branch information
zouyee committed Nov 24, 2023
1 parent a0ae1c2 commit c97a9c4
Show file tree
Hide file tree
Showing 6 changed files with 603 additions and 239 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ cgutil:
proto:
protobuild --quiet ${PACKAGES}
# Keep them Go-idiomatic and backward-compatible with the gogo/protobuf era.
go-fix-acronym -w -a '(Cpu|Tcp|Rss)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go')
go-fix-acronym -w -a '(Cpu|Tcp|Rss|Psi)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go')
7 changes: 6 additions & 1 deletion cgroup2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
NrPeriods: out["nr_periods"],
NrThrottled: out["nr_throttled"],
ThrottledUsec: out["throttled_usec"],
PSI: getStatPSIFromFile(filepath.Join(c.path, "cpu.pressure")),
}
metrics.Memory = &stats.MemoryStat{
Anon: out["anon"],
Expand Down Expand Up @@ -596,6 +597,7 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
UsageLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.max")),
SwapUsage: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.current")),
SwapLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.max")),
PSI: getStatPSIFromFile(filepath.Join(c.path, "memory.pressure")),
}
if len(memoryEvents) > 0 {
metrics.MemoryEvents = &stats.MemoryEvents{
Expand All @@ -606,7 +608,10 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
OomKill: memoryEvents["oom_kill"],
}
}
metrics.Io = &stats.IOStat{Usage: readIoStats(c.path)}
metrics.Io = &stats.IOStat{
Usage: readIoStats(c.path),
PSI: getStatPSIFromFile(filepath.Join(c.path, "io.pressure")),
}
metrics.Rdma = &stats.RdmaStat{
Current: rdmaStats(filepath.Join(c.path, "rdma.current")),
Limit: rdmaStats(filepath.Join(c.path, "rdma.max")),
Expand Down
Loading

0 comments on commit c97a9c4

Please sign in to comment.