Skip to content

Instantly share code, notes, and snippets.

@necrophidia
Created February 5, 2018 05:15
Show Gist options
  • Save necrophidia/e6c8385a3de57a905cccb242e0e032c7 to your computer and use it in GitHub Desktop.
Save necrophidia/e6c8385a3de57a905cccb242e0e032c7 to your computer and use it in GitHub Desktop.
Simple Sample To Use Performance Counter
using System;
namespace PerformanceCounter
{
class Program
{
static void Main(string[] args)
{
using (var counter = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes"))
{
float counterValue = counter.NextValue();
Console.WriteLine(counterValue);
// or you can do whatever you want with the value
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment