I am using the System.Data PerfomanceCounter
class, and I have found some very specific examples of how to retrieve disk space or CPU usage.
However I am unable to find the documentation on the possible values for:
PerfomanceCounter.CategoryName
PerformanceCounter.CounterName
PerformanceCounter.InstanceName
I can see from the class the different parameters I can pass to the constructor, but even going to the page for say CategoryName does not give me a list of available values.
Can anyone offer and advice on how to find available values for these?
Thanks!
Those can be obtained from the PerformanceCounterCategory
class:
PerformanceCounterCategory[] categories = PerformanceCounterCategory.GetCategories();
foreach(var category in categories)
{
string[] instanceNames = category.GetInstanceNames();
foreach(string instanceName in instanceNames)
PerformanceCounter[] counters = category.GetCounters(instanceName);
}