dotnet / dotnet/dotnet-api-docs
Add information on using V2 performance counters
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Type of issue
Additional information needed.
### Description
Performance counters are implemented as either V1 or V2, and V2 is not fully supported. This should be documented as well as any workaround such as using lower-level P/Invoke calls discussed at https://learn.microsoft.com/windows/win32/perfctrs/using-the-pdh-functions-to-consume-counter-data.
For V2, `CounterSample.CounterTimeStamp` uses a different "origin point" for the time affecting other members such as `NextValue()` leading to zeros being returned, for example.
An example of a V2 performance counter is "HTTP Service Request Queues\MaxQueueItemAge".
### Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.performancecounter?view=net-8.0
### Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Diagnostics/PerformanceCounter.xml
### Document Version Independent Id
2d744cbe-19e0-46da-2b4c-d87599c4b877
### Article author
steveharter
Contributor guide
Assessment
This issue has not been assessed yet.