Cherry-pick #18361 to 7.8: perfmon - remove negative counter value errors from the event output #18450
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.
Cherry-pick of PR #18361 to 7.8 branch. Original message:
What does this PR do?
PDH_CALC_NEGATIVE_VALUE
andPDH_INVALID_DATA
type errors from the event outputcstatus
value in the debug informationWhy is it important?
When collecting a high number of counters values seems that for specific processes the counter values retrieved are negative and the win32 api returns the error:
0x800007D8 (PDH_CALC_NEGATIVE_VALUE) | A counter with a negative value was detected.
or
0xC0000BC6 (PDH_INVALID_DATA) | The data is not valid.
with cstatus0xC0000BBA (PDH_CSTATUS_INVALID_DATA) | The returned data is not valid.
Which means the counter was successfully found, but the data returned is not valid. This error can occur if the counter value is less than the previous value. (Because counter values always increment, the counter value rolls over to zero when it reaches its maximum value.) Another possible cause is a system timer that is not correct.
These errors do not cause the application to run unsuccessfully and the following calls return a positive value.
These types of errors are still logged as debug messages.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Create a perfmon configuration with a high number of perfmon counters including
Process
object counters since the errors are encountered only at that level and run the perfmon metricset with a small interval.Related issues
Logs