| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 2008/9/8 Melroy <melroysoares@hotmail.com>: > 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? use Benchmark::Timer; http://search.cpan.org/~dcoppit/Benc...hmark/Timer.pm |
|
#3
| |||
| |||
| 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 > > > |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.