Skip to content

Commit 4ba5b2a

Browse files
authored
Merge pull request #11 from zoues/burst
introduce cpu burst stat
2 parents 2a61bab + c21b748 commit 4ba5b2a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

fs2/cpu.go

+6
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ func statCpu(dirPath string, stats *cgroups.Stats) error {
108108

109109
case "throttled_usec":
110110
stats.CpuStats.ThrottlingData.ThrottledTime = v * 1000
111+
112+
case "nr_bursts":
113+
stats.CpuStats.BurstData.BurstsPeriods = v
114+
115+
case "burst_usec":
116+
stats.CpuStats.BurstData.BurstTime = v * 1000
111117
}
112118
}
113119
if err := sc.Err(); err != nil {

stats.go

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ type ThrottlingData struct {
99
ThrottledTime uint64 `json:"throttled_time,omitempty"`
1010
}
1111

12+
type BurstData struct {
13+
// Number of periods bandwidth burst occurs
14+
BurstsPeriods uint64 `json:"bursts_periods,omitempty"`
15+
// Cumulative wall-time that any cpus has used above quota in respective periods
16+
// Units: nanoseconds.
17+
BurstTime uint64 `json:"burst_time,omitempty"`
18+
}
19+
1220
// CpuUsage denotes the usage of a CPU.
1321
// All CPU stats are aggregate since container inception.
1422
type CpuUsage struct {
@@ -48,6 +56,7 @@ type CpuStats struct {
4856
CpuUsage CpuUsage `json:"cpu_usage,omitempty"`
4957
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
5058
PSI *PSIStats `json:"psi,omitempty"`
59+
BurstData BurstData `json:"burst_data,omitempty"`
5160
}
5261

5362
type CPUSetStats struct {

0 commit comments

Comments
 (0)