Jump to content

Topper

Members
  • Posts

    8
  • Joined

  • Last visited

Topper's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Sorry maybe I'm stupid or not so smart but... #include <Array.au3> #include <_PDH_ProcessCounters.au3> #include <_PDH_ProcessAllCounters.au3> _PDH_Init() Local $poCounter,$sProcess,$aProcess,$TotalCount=0 Local $CounterValue,$ProcessCount _PDH_ProcessAlInit($_PDH_iCPUCount) ;If @error Then Exit _PDH_UnInit() $sProcess="chrome.exe" $ProcessCount=ProcessList($sProcess) $TotalCount=$ProcessCount [0][0] MsgBox(0, "Process count",$TotalCount,1) for $i = 1 to $TotalCount $poCounter=_PDH_ProcessObjectCreate($ProcessCount[$i][0],$ProcessCount[$i][1]) _PDH_ProcessObjectAddCounters($poCounter,6) ; "% Processor Time" ;~ _ArrayDisplay ($poCounter, "CPU Usage of processes") Next $poCounter=_PDH_ProcessAllUpdateCounters() $poCounter=_PDH_ProcessObjectUpdateCounters($poCounter) for $i = 1 to $TotalCount $CounterValue=Round(_PDH_ProcessObjectUpdateCounters($poCounter [$i][2],0)/$_PDH_iCPUCount) MsgBox(0, "Stats", "Process name "&$poCounter[$i][0]&" PID "&$poCounter[$i][1]&" %CPU "&$CounterValue,1) Next _PDH_ProcessObjectDestroy($poCounter) _PDH_UnInit() With _ArrayDisplay ($poCounter, "CPU Usage of processes") script show me that counter %CPU is added in array But the MsgBox(0, "Stats", "Process name "&$poCounter[$i][0]&" PID "&$poCounter[$i][1]&" %CPU "&$CounterValue,1) give me a error:
  2. I need to monitor only one process from different users but not so important which user own that overloading process simple must to close/kill it when that overload continue 30 min for example. Sorry that I disturb you, but I used AutoIt long time ago and I'm afraid that not have enough knowledge to make the script
  3. What about when process have several instances ? How to return the info in 2D area ?
  4. You are on right way. It's not necessary to be a server, could be a personal computer with 2 or 3 co-workers logged in with Remote Desktop Protokol. But one of them started long and heavy operation with program process.exe - by mistake or purposely. So I want to kill this process when it takes a lot of processor time for a long period because I don't need to suffer rest of users. Actually I'v got 15 remote users on Win2k3 running same program trough its login script. Some time one or two of them start to over load and I need to close this processes. That's the way I think. PS:This picture means, that we have on ONE machine few processes with different sessions and different CPU Usage: 123 server/user1 process.exe 1% 345 server/user2 process.exe 2% 567 server/user3 process.exe 90% 789 server/user4 process.exe 50% The script must kill process PID 567 from user 3 if it takes 15 minute to run above watermark level 85% for examp.
  5. Yeah, looks easy according this post But what about when process's are many from different user on same machine. I'm talking about Win2k3 server and remote logged users. Please advice ?
  6. Is it possible with AutoIT3 (I'm sure it is) to be made monitor, which to monitor specific process with known name ( or unknown name for unification) and this process overload CPU above some limit for specific time. For ex. if process.exe runs above 90% CPU more than 1 min - kill it or restart it. Will be thankful for any help. I'm asking because made only simple scripts, nothing with WMI. Some additional goals - this watched process may be run from different users and must be killed/restarted only specific. I mean that snippets like "Finding if an Application is Hung" from URL http://quadryders.com/phpcc/snippet.php?sid=28 !! WILL NOT ABLE TO DO THE JOB !!
  7. Is it possible to be modified script as to monitor if Process get 100% from CPU for $time? In other words - to kill overloading process under Win2k3 ?
×
×
  • Create New...