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
6 changes: 6 additions & 0 deletions fs2/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func statCpu(dirPath string, stats *cgroups.Stats) error {

case "throttled_usec":
stats.CpuStats.ThrottlingData.ThrottledTime = v * 1000

case "nr_bursts":
stats.CpuStats.BurstData.BurstsPeriods = v

case "burst_usec":
stats.CpuStats.BurstData.BurstTime = v * 1000
}
}
if err := sc.Err(); err != nil {
Expand Down
9 changes: 9 additions & 0 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ type ThrottlingData struct {
ThrottledTime uint64 `json:"throttled_time,omitempty"`
}

type BurstData struct {
// Number of periods bandwidth burst occurs
BurstsPeriods uint64 `json:"bursts_periods,omitempty"`
// Cumulative wall-time that any cpus has used above quota in respective periods
// Units: nanoseconds.
BurstTime uint64 `json:"burst_time,omitempty"`
}

// CpuUsage denotes the usage of a CPU.
// All CPU stats are aggregate since container inception.
type CpuUsage struct {
Expand Down Expand Up @@ -48,6 +56,7 @@ type CpuStats struct {
CpuUsage CpuUsage `json:"cpu_usage,omitempty"`
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
PSI *PSIStats `json:"psi,omitempty"`
BurstData BurstData `json:"burst_data,omitempty"`
}

type CPUSetStats struct {
Expand Down