-
Notifications
You must be signed in to change notification settings - Fork 810
Add resiliency to Resource Monitoring in Linux #6489
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
base: main
Are you sure you want to change the base?
Add resiliency to Resource Monitoring in Linux #6489
Conversation
{ | ||
return []; | ||
} | ||
|
||
try | ||
{ | ||
List<DiskStats> diskStatsList = _diskStatsReader.ReadAll(); |
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.
I am sorry, I did not have time to review previous PRs, but here we have two List<> allocations - first inside the .ReadAll()
method and second with .ToList()
on line 160.
- Can we fold it into one allocation?
- Can we avoid allocations at all and use object pooling for the List<>?
- Can we do
.ToArray()
on line 160 instead of.ToList()
because we don't really need it to be List<> further in the flow?
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.
If you feel like it is not in scope of this PR, please address in a follow-up PR, of course
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.
I moved filtering to ReadAll()
, so filtering happens on read, in result we don't have to enumerate twice, and additionally we skip second allocation. Also, switched to array as suggested for performance reasons
Partially fixes #6478
This PR address Linux RM for Disk and Networking. To make PR smaller CPU and Memory will be addressed in separated ones. Later I will check what we can do for Windows.
Microsoft Reviewers: Open in CodeFlow