static void Main(string[] args) { while (true) { Console.WriteLine("Available Physical Memory (MiB) " + PerformanceInfo.GetPhysicalAvailableMemoryInMiB().ToString()); Console.ReadLine(); } }
static void Main(string[] args) { while (true) { Int64 phav = PerformanceInfo.GetPhysicalAvailableMemoryInMiB(); Int64 tot = PerformanceInfo.GetTotalMemoryInMiB(); decimal percentFree = ((decimal)phav / (decimal)tot) * 100; decimal percentOccupied = 100 - percentFree; Console.WriteLine("Available Physical Memory (MiB) " + phav.ToString()); Console.WriteLine("Total Memory (MiB) " + tot.ToString()); Console.WriteLine("Free (%) " + percentFree.ToString()); Console.WriteLine("Occupied (%) " + percentOccupied.ToString()); Console.ReadLine(); } }