Skip to content

Instantly share code, notes, and snippets.

@sajayantony
Last active August 29, 2015 14:08
Show Gist options
  • Save sajayantony/85189bdf7ec0ed3ce97c to your computer and use it in GitHub Desktop.
Save sajayantony/85189bdf7ec0ed3ce97c to your computer and use it in GitHub Desktop.
Performance Counter Names
var query = PerformanceCounterCategory
.GetCategories()
.SelectMany (category =>
category.GetInstanceNames()
.DefaultIfEmpty(string.Empty)
.SelectMany (name => category.GetCounters(name)))
.Select (counter => {
var name = String.IsNullOrEmpty(counter.InstanceName)? string.Empty: "\\(" + counter.InstanceName + ")";
return "\\" + counter.CategoryName + name + "\\" + counter.CounterName;
});
var counters = query.Take(500).Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment