Re: CPU load and by id
Re: CPU load and by id
- Subject: Re: CPU load and by id
- From: Takaaki Naganoya <email@hidden>
- Date: Fri, 24 Mar 2006 12:08:34 +0900
- Thread-topic: CPU load and by id
How about this code?
<AppleScript>
set aPID to 1089 --example
set b to getLoadAVGofProcess(aPID) of me
--Get CPU Load of a Process indicated by Process ID
on getLoadAVGofProcess(aPID)
set aShellText to "ps -auxc -p " & aPID & " | awk '{print $3}' "
try
set a to do shell script aShellText
set b to item 2 of (paragraphs of a)
set b to b as number
on error
set b to 0
end try
return b
end getLoadAVGofProcess
</AppleScript>
--
Takaaki Naganoya
Piyomaru Software
http://www.appleco.jp/piyomarusoft/
On 06.3.24 3:44 AM, "Jeremy Matthews" <email@hidden> wrote:
> Anyone know the "best" way to find how much load a process is producing on a
> system...if so, by name?
>
> I use this to find a process' ID...and works (mostly)
>
> do shell script "my_command &> /dev/null & echo $!"
> -- result: 621
> set pid to the result
>
> But, I'm not sure how to find this process' current load...any ideas?
>
> Thanks,
> jeremy
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden