0

how to detect window process with high CPU or memory usage
when detected the process is high CPU or memory usage, then restart it.
For example, when the "chrome.exe" is high CPU or memory usage and detected:
Then restart the chrome

Runtime.getRuntime().exec("taskkill /im chrome.exe /f");
Runtime.getRuntime().exec("start chrome");
Peppo
  • 1,107
  • 1
  • 12
  • 19
Harrychu
  • 31
  • 5
  • Break the task down: 1) do you know how to get the task list (e.g. http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java) 2) do you know how to get the CPU or memory usage of a process in that list? – Andy Turner Oct 20 '15 at 07:39
  • i know, tasklist is show all using process, but how can i detect the process which using a lot of CPU or memory usage? And i dont want to detect system process. – Harrychu Oct 20 '15 at 07:41
  • 1
    Possible duplicate of http://stackoverflow.com/questions/1767271/using-java-to-retrieve-the-cpu-usage-for-windows-processes – Manu Oct 20 '15 at 08:16
  • Possibly same as http://stackoverflow.com/q/33227718/4725592 – Rohan Oct 20 '15 at 08:18
  • @Rohan this idea is work for me! – Harrychu Oct 20 '15 at 08:56

0 Answers0