Hi Melroy,

Others have replied with information about benchmarking; if all you want is to do what /usr/bin/time does, then yes, "times" is all you need. Note that it isn't "benchmarking", it is doing exactly what /usr/bin/time does...give you the process time. Benchmarking is a stronger work, and that requires the aforementioned library.

As http://perldoc.perl.org/functions/times.html says, all you do is:

   ($user,$system,$cuser,$csystem) = times;

The result is a 4-element array and depends on whether you want the time of the current or child process and which time (user or system).

"times" takes a snapshot of the time at that point in the program. /usr/bin/time does the same thing, but at the end of your program (and thus, reports the time for the entire program). If you want to test a portion of code, call "times" at the beginning and again at the end of that section of code. Then, take the difference and convert the result from seconds to whatever you want.

Ray



Melroy wrote:
Hi all,
I want to benchmark a bunch of running processes using Perl , but I
could not find any equivalent for the unic time coammnd in perl? Can
someone point to me
if such a function exists in perl? The only command I found was
"times",
but I don't know how to use it. doing a websearch did not help.
Thanks




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to