Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Cap overalPct at 100% to avoid wrong values #21

Merged
merged 3 commits into from
Jul 24, 2017
Merged

Conversation

marc921
Copy link
Contributor

@marc921 marc921 commented Jul 24, 2017

No description provided.

@marc921 marc921 requested a review from conorbranagan July 24, 2017 14:58
Copy link
Contributor

@conorbranagan conorbranagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit. When added you can go ahead and merge

@@ -260,6 +260,10 @@ func calculatePct(deltaProc, deltaTime, numCPU float64) float32 {
// on a 2-CPU-core system would be reported as 50% instead of 100%.
overalPct := (deltaProc / deltaTime) * 100

if overalPct > 100 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: can you add a comment of explanation. something simple like "Sometimes we get values that don't make sense, so we clamp to 100%"

@marc921 marc921 merged commit 60b0047 into master Jul 24, 2017
@marc921 marc921 deleted the marc.brun/clampingCPU branch July 24, 2017 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants