-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: Display CPU cores and CPU seconds for samples count profiles #4304
Conversation
🤖 Meticulous spotted visual differences in 183 of 375 screens tested: view and approve differences detected. Last updated for commit fe9d3ff. This comment will update as new commits are pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice!
parca.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was probably pushed by accident.
preProjection := []logicalplan.Expr{ | ||
logicalplan.Mul(logicalplan.Div(logicalplan.Col(profile.ColumnTimestamp), logicalplan.Literal(step.Milliseconds())), logicalplan.Literal(step.Milliseconds())).Alias(profile.ColumnTimestamp), | ||
logicalplan.DynCol(profile.ColumnLabels), | ||
logicalplan.Col(profile.ColumnDuration), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩
parca.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this got pushed by accident.
// Because we store the period with each sample yet query for the sum(period) we need to normalize by the amount of values (rows in a database). | ||
period := periodSum / valueCount | ||
// Because we store the duration with each sample yet query for the sum(duration) we need to normalize by the amount of values (rows in a database). | ||
duration := durationSum / valueCount | ||
|
||
// If we have a CPU samples value type we make sure we always do the next calculation with cpu nanoseconds. | ||
// If we already have CPU nanoseconds we don't need to multiply by the period. | ||
valuePerSecondSum := valueSum | ||
if sampleTypeUnit != "nanoseconds" { | ||
valuePerSecondSum = valueSum * period | ||
} | ||
|
||
valuePerSecond := float64(valuePerSecondSum) / float64(duration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
This patch changes the UX of interacting with CPU profiling data that only reports samples count. It ensures that samples count is multiplied by their period (the time between samples), which allows comparing two profiles that were taken at different frequencies. As a side effect while changing the queries, this also fixed an issue where the average cpu time was previously summed up over a step period, which was incorrect, as the total cpu time over the step needs to be divided by the total duration over the step.
This patch changes the UX of interacting with CPU profiling data that only reports samples count. It ensures that samples count is multiplied by their period (the time between samples), which allows comparing two profiles that were taken at different frequencies.
As a side effect while changing the queries, this also fixed an issue where the average cpu time was previously summed up over a step period, which was incorrect, as the total cpu time over the step needs to be divided by the total duration over the step.