Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > when x process isn't running... do something

Reply
Thread Tools

when x process isn't running... do something

 
 
Bart Nessux
Guest
Posts: n/a
 
      01-23-2004
Howdy,

I'm trying to time how long it takes dd to run on a G5, versus how long
it takes to run on a G4 (PATA vs. SATA). Both sytems have Mac OS X
10.3.2 and Python 2.3. Could someone demonstrate how I might use Python
to monitor for the presense of a process and to do something (in this
case send an email which I know how to do) as soon as that process is no
longer present? Any suggestions on how to monitor? Call top every 5 secs
and read it's output searching for 'dd'???

TIA,
Bart

 
Reply With Quote
 
 
 
 
Bart Nessux
Guest
Posts: n/a
 
      01-23-2004
Bart Nessux wrote:
> Howdy,
>
> I'm trying to time how long it takes dd to run on a G5, versus how long
> it takes to run on a G4 (PATA vs. SATA). Both sytems have Mac OS X
> 10.3.2 and Python 2.3. Could someone demonstrate how I might use Python
> to monitor for the presense of a process and to do something (in this
> case send an email which I know how to do) as soon as that process is no
> longer present? Any suggestions on how to monitor? Call top every 5 secs
> and read it's output searching for 'dd'???
>
> TIA,
> Bart
>


I forgot to mention the fact that I already know when the process began.
All I need to know is when it ends and then I can calculate the part in
between those two points.

 
Reply With Quote
 
 
 
 
Josiah Carlson
Guest
Posts: n/a
 
      01-23-2004
Bart Nessux wrote:

> Bart Nessux wrote:
>
>> Howdy,
>>
>> I'm trying to time how long it takes dd to run on a G5, versus how
>> long it takes to run on a G4 (PATA vs. SATA). Both sytems have Mac OS
>> X 10.3.2 and Python 2.3. Could someone demonstrate how I might use
>> Python to monitor for the presense of a process and to do something
>> (in this case send an email which I know how to do) as soon as that
>> process is no longer present? Any suggestions on how to monitor? Call
>> top every 5 secs and read it's output searching for 'dd'???
>>
>> TIA,
>> Bart
>>

>
> I forgot to mention the fact that I already know when the process began.
> All I need to know is when it ends and then I can calculate the part in
> between those two points.
>


Why not just:

import time
import os
start = time.time()
s = os.system('dd <args>')
print time.time()-start


- Josiah
 
Reply With Quote
 
Bart Nessux
Guest
Posts: n/a
 
      01-23-2004
Josiah Carlson wrote:
> Bart Nessux wrote:
>
>> Bart Nessux wrote:
>>
>>> Howdy,
>>>
>>> I'm trying to time how long it takes dd to run on a G5, versus how
>>> long it takes to run on a G4 (PATA vs. SATA). Both sytems have Mac OS
>>> X 10.3.2 and Python 2.3. Could someone demonstrate how I might use
>>> Python to monitor for the presense of a process and to do something
>>> (in this case send an email which I know how to do) as soon as that
>>> process is no longer present? Any suggestions on how to monitor? Call
>>> top every 5 secs and read it's output searching for 'dd'???
>>>
>>> TIA,
>>> Bart
>>>

>>
>> I forgot to mention the fact that I already know when the process
>> began. All I need to know is when it ends and then I can calculate the
>> part in between those two points.
>>

>
> Why not just:
>
> import time
> import os
> start = time.time()
> s = os.system('dd <args>')
> print time.time()-start
>
>
> - Josiah


That works great... i didn't think of using time (the module)... had to
rewrite my function to contain sub-functions so that I could time each
piece of it seperately. Thanks for the tip!!!

Bart

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath query for <?define something="something" ?> Pekka Järvinen XML 2 04-29-2008 08:12 PM
How to find and replace something that is nested inside something else? alainfri@gmail.com Perl Misc 4 05-31-2007 11:50 PM
var Something= new Something() What does it mean ? pamelafluente@libero.it Javascript 9 10-05-2006 02:43 PM
umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0 C++ 4 10-13-2004 10:34 PM
A process serving application pool 'DefaultAppPool' exceeded time limits during start up. The process id was '216'. jack ASP .Net 0 08-01-2004 09:49 PM



Advertisments