Skip to content
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

Compute cpuRatio values when computing the derived thread #5288

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mstange
Copy link
Contributor

@mstange mstange commented Jan 2, 2025

Production | Deploy preview

processThreadCPUDelta makes it so that the threadCPUDelta column doesn't have any null values. However, the type of the threadCPUDelta column still looks as if values could be null.
Now that we have a derived Thread type, we can change the type so that it expresses that the values can't be null. So we move the call to processThreadCPUDelta a bit earlier in the derivation pipeline so that all the types work out.

Even better, we can compute CPU ratios at this point, and not even store the "clamped and non-null cpu delta" values.

And since we're doing that, I'm changing the behavior for null cpu delta values: Rather than using the closest non-null cpu delta and spreading it over a potentially-different sample time delta, just set the cpu ratio to 1. The only known cause of null values (other than the first value, which we ignore) is the base profiler, and we want CPU percentage to be reported as 100% during the base profiler time.

Fixes #4072.

@mstange mstange force-pushed the push-uvqxurtzkpsk branch 2 times, most recently from 128fdbf to 1f72810 Compare January 2, 2025 22:41
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.02%. Comparing base (52f3144) to head (254026d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5288      +/-   ##
==========================================
- Coverage   86.02%   86.02%   -0.01%     
==========================================
  Files         311      312       +1     
  Lines       29791    29750      -41     
  Branches     8217     8191      -26     
==========================================
- Hits        25629    25592      -37     
+ Misses       3576     3572       -4     
  Partials      586      586              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstange mstange force-pushed the push-uvqxurtzkpsk branch from 1f72810 to 22e9b62 Compare January 3, 2025 20:26
@mstange mstange force-pushed the push-uvqxurtzkpsk branch 4 times, most recently from e5178f9 to 7aeaf62 Compare January 20, 2025 18:30
@mstange mstange changed the title In the derived Thread type, make it clear that threadCPUDelta doesn't have null values Compute cpuRatio values when computing the derived thread Jan 20, 2025
@mstange mstange force-pushed the push-uvqxurtzkpsk branch 4 times, most recently from 2fd1aaf to edb7649 Compare January 23, 2025 18:55
@mstange mstange marked this pull request as ready for review January 23, 2025 18:55
@mstange mstange requested a review from canova January 23, 2025 18:55
@mstange mstange self-assigned this Jan 23, 2025
This avoids a circular dependency between cpu.js, process-profile.js and profile-data.js,
because in the next commit I want to use a function from cpu.js in profile-data.js.
It looks like I forgot to update this comment when I
changed this function to no longer use the interval.
This makes it clearer that, with time-based CPU deltas, you
can have profiles that never hit 100% CPU usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert threadCPUDelta values into cpuRatios in the Thread process pipeline with strong types
1 participant