Skip to content

Commit

Permalink
Merge pull request #1300 from sleepyzhang/fixCpuUsageComputationExcep…
Browse files Browse the repository at this point in the history
…tion

kernel bug lead to incorrect cpu usage
  • Loading branch information
k8s-ci-robot committed Jul 31, 2023
2 parents aea89d8 + 82a7323 commit 1693eb0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type MetricsPoint struct {
}

func resourceUsage(last, prev MetricsPoint) (corev1.ResourceList, api.TimeInfo, error) {
if last.StartTime.Before(prev.StartTime) {
return corev1.ResourceList{}, api.TimeInfo{}, fmt.Errorf("unexpected decrease in startTime of node/container")
}
if last.CumulativeCpuUsed < prev.CumulativeCpuUsed {
return corev1.ResourceList{}, api.TimeInfo{}, fmt.Errorf("unexpected decrease in cumulative CPU usage value")
}
Expand Down

0 comments on commit 1693eb0

Please sign in to comment.