using System;
using System.Diagnostics;
class MainClass
{
public static void Main()
{
int totMemory = 0;
Console.WriteLine("Info for all processes:");
Process[] allProcs = Process.GetProcesses();
foreach(Process thisProc in allProcs)
{
DateTime started = thisProc.StartTime;
totMemory += physMemory;
Console.WriteLine("Process: {0}, ID: {1}", thisProc.ProcessName, thisProc.Id);
Console.WriteLine(" virtual memory: {0}", thisProc.VirtualMemorySize);
Console.WriteLine(" private memory: {0}", thisProc.PrivateMemorySize);
Console.WriteLine(" physical memory: {0}", thisProc.WorkingSet);
}
Console.WriteLine("\nTotal physical memory used: {0}", totMemory);
}
}
|