Created
February 5, 2018 05:15
-
-
Save necrophidia/e6c8385a3de57a905cccb242e0e032c7 to your computer and use it in GitHub Desktop.
Simple Sample To Use Performance Counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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