Guest User

Untitled

a guest
Jun 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. ServerManager serverManager = new ServerManager();
  2. ApplicationPoolCollection applicationPoolCollection = serverManager.ApplicationPools;
  3.  
  4.  
  5. Process process = Process.GetProcessById(applicationPoolCollection.Where(p => p.Name == "mywebsite.com").First().WorkerProcesses[0].ProcessId);
  6.  
  7. PerformanceCounter performanceCounter = new PerformanceCounter();
  8.  
  9. performanceCounter.CategoryName = "Process";
  10.  
  11. performanceCounter.CounterName = "Working Set";
  12.  
  13. performanceCounter.InstanceName = process.ProcessName;
  14. Console.WriteLine(((uint)performanceCounter.NextValue() / 1024).ToString("N0"));
Add Comment
Please, Sign In to add comment