Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ServerManager serverManager = new ServerManager();
- ApplicationPoolCollection applicationPoolCollection = serverManager.ApplicationPools;
- Process process = Process.GetProcessById(applicationPoolCollection.Where(p => p.Name == "mywebsite.com").First().WorkerProcesses[0].ProcessId);
- PerformanceCounter performanceCounter = new PerformanceCounter();
- performanceCounter.CategoryName = "Process";
- performanceCounter.CounterName = "Working Set";
- performanceCounter.InstanceName = process.ProcessName;
- Console.WriteLine(((uint)performanceCounter.NextValue() / 1024).ToString("N0"));
Add Comment
Please, Sign In to add comment