Change PI cpu usage to match widget usage #3171
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the pull request
Changes the CPU usage calculation in Project Ironsides to match that of the CPU widget. Both are now very close to task manager's reporting, within reasonable expectations given different polling times and that one monitor's execution can affect the CPU and thereby change the other monitors' results.
References and relevant issues
Closes #3160
Detailed description of the pull request / Additional comments
The values are unlikely to match exactly due to different polling times. Task manager, the widget, and PI poll at 1s intervals, but even slight differences in the time they poll can give different results. Since PerformanceCounter.NextValue() is actually itself rather heavy on CPU, one monitor can affect other monitors. For this reason, two components can use the same perf counter but have slightly different results, so we do not expect them to match precisely. We do expect them to be reasonably close over time.
In analyzing which metric was most correct, I compared Task Manager CPU utilization to the CPU widget utilization and found them to be very close, producing a very similar graph and numbers that were often the same. Since it appears these two are consistent with each other, I changed the PI CPU usage to match the CPU widget's perf counter category, name, and calculation.
Validation steps performed
PR checklist