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

Introducing Environment.CpuUsage #105152

Merged
merged 24 commits into from
Jul 21, 2024

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jul 19, 2024

Fixes #104844.

@dotnet-issue-labeler dotnet-issue-labeler bot added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners new-api-needs-documentation labels Jul 19, 2024
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@tarekgh tarekgh added this to the 9.0.0 milestone Jul 19, 2024
@tarekgh tarekgh added area-System.Runtime and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jul 19, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

@tarekgh tarekgh changed the title Introducing Environment.CpuUsage [WIP] Introducing Environment.CpuUsage Jul 19, 2024
@tarekgh tarekgh force-pushed the Introducing-Environment.CpuUsage branch from 02e0c76 to 14404e6 Compare July 19, 2024 23:13
Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

LGTM

@tarekgh
Copy link
Member Author

tarekgh commented Jul 21, 2024

@jkotas @stephentoub now all feedback is addressed, and we have a clean CI run (I am just rerunning now the unrelated failed tests, but everything related to my change is passing). Thanks again for all feedback. I assume we are good to go now.

Assert.True(usage.TotalTime - totalTime < delta);

Thread.Sleep(100);
}
Copy link
Member

@stephentoub stephentoub Jul 21, 2024

Choose a reason for hiding this comment

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

Would any of these tests fail if we had a bug where, for example, we reported 5ms instead as 5us or vice versa?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure we can be that accurate without writing the tests calling the underlying OS. I tried to look at the Process tests and couldn't find a test doing that either.

@tarekgh tarekgh merged commit 7069cb3 into dotnet:main Jul 21, 2024
144 of 147 checks passed
@tarekgh tarekgh deleted the Introducing-Environment.CpuUsage branch August 6, 2024 20:04
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introducing Environment.ProcessorUserTime & ProcessorPrivilegedTime
7 participants