Robert Killheffer wrote:> Thanks. I believe the cygwin tools are on the box I'm using (if not, I can> install them).> > From your example, it looks like this 
works as long as I'm calling the> scripts from the command line. But I've got them running as scheduled tasks> under the Windows scheduling system. Can I use the 
time command in that> context? Perhaps through a system call from the script? Like I said, I'd> like to be able to gather this data automatically while the script 
is> running, and output it to a log each time.> > - Rob> > -----Original Message-----> From: Daniel Rawson [mailto:[EMAIL PROTECTED] > Sent: 
Tuesday, March 14, 2006 9:08 AM> To: Robert Killheffer> Cc: perl-win32-users@listserv.activestate.com> Subject: Re: System resources used by Perl script> 
> Robert Killheffer wrote:> >>I'm testing several different algorithms for performing the same task, and>>I'm wondering if there is some way I can tell 
- from within each version> > of> >>my script - how m!
uch memory and CPU time the script uses each time it> > runs.> >> >>>>I would like to be able to output this information to a log, so that I can>>compare these values for the different scripts across a period of 
time.>>>> >>>>I'd be grateful for any suggestions.>>>> >>>>Thanks,>>>>Rob K.> > If you have the cygwin tools on your Win32 box, the ported Unix "time"> command is there which will give 
you the CPU time and the "resident set> size":> > time -v dir> .......> Command being timed: "dir">  User time (seconds): 0.03>   System time (seconds): 0.01>         Percent of CPU this job got: 195%>   Elapsed (wall 
clock) time (h:mm:ss or m:ss): 0:00.02>        Average shared text size (kbytes): 0>        Average unshared data size (kbytes): 0>      Average stack size (kbytes): 0>      Average total size (kbytes): 0>      Maximum resident set size (kbytes): 
14160>   Average resident set size (kbytes): 0>       Major (requiring I/O) page faults: 885>      Minor (reclaiming a frame) page faults: 0>   Voluntary context switches!
: 0>         Involuntary context switches: 0>     Swaps: 0>    File system 
inputs:
0>   File system outputs: 0>      Socket messages sent: 0>     Socket messages received: 0>         Signals 
delivered: 0>        Page size (bytes): 4096>     Exit status: 0> > From the CPU percentage above, I don't think 
that part is accurate :-) the> memory usage looks good . . .  This example is a single-processor machine> running XP 
SP2, YMMV . . . .> > > Dan> > Rob -
You can't call the 'time' command from inside the script because it needs to monitor the 
script's processes; I suspect you'd have a "chicken and egg" problem :-))  But you 
could make a new scheduler task that runs 'time -v scriptname > logfile' or something 
similar.  Or stuff the whole thing in a batch file and run that . . . .
Note that the Unix version of the command does NOT send it's output to STDOUT so a normal re-direct might not work; you should do a bit of experimenting with the cygwin stuff to see. cmd.exe should take 'time -v scriptname > logfile 2>&1' to do both STDOUT and STDERR. Dan

--
The information contained in this communication and any attachments is 
confidential and may be privileged, and is for the sole use of the intended 
recipient(s). Any unauthorized review, use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify the sender 
immediately by replying to this message and destroy all copies of this message 
and any attachments. ASML is neither liable for the proper and complete 
transmission of the information contained in this communication, nor for any 
delay in its receipt.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to