-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
feat: add cumulativeCPUUsage to AppMetrics and CPUUsage #41819
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
3e93a90
to
ac3d74f
Compare
dfe3d4e
to
80c045f
Compare
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.
API LGTM
80c045f
to
ac98b04
Compare
API LGTM |
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.
API LGTM
@rcombs can you rebase and fix conflicts? |
ac98b04
to
39d04bf
Compare
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.
@rcombs if you can fix the build failures we should be able to get this merged in.
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.
API LGTM
cpu_dict.Set("percentCPUUsage", usage / processor_count); | ||
// Default usage percentage to 0 for compatibility | ||
double usagePercent = 0; | ||
if (auto usage = process_metric.second->metrics->GetCumulativeCPUUsage()) { |
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 needs to use the base::TimeDelta value. A gin converter (see time_converter.cc) might need to be added for the JS binding, if it's not set as a primitive type.
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.
@rcombs are you still interested in moving this forward?
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 is no longer needed after the build failures were resolved ✅
This allows apps to measure their CPU usage over any given period without worrying about other calls affecting the output, as they would with `percentCPUUsage`.
39d04bf
to
a30718b
Compare
Rebased to fix the conflicts/failures; not entirely sure what the other ask here is about. I'd also like to add something to retrieve the total usage of all processes that have already exited (Chromium reports this in |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
Description of Change
This allows apps to measure their CPU usage over any given period without worrying about other calls affecting the output, as they would with
percentCPUUsage
.Checklist
npm test
passesHaven't run the tests because I couldn't get the build process to cooperate locally, but this worked fine and returned results in line with expectations on a CI build I ran.
Release Notes
Notes: Added
cumulativeCPUUsage
to AppMetrics and CPUUsage