🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.perl
5 messages
5 total messages Started by cjz Wed, 29 Oct 1997 17:23
Execution time in Perl
#640
Author: cjz
Date: Wed, 29 Oct 1997 17:23
12 lines
1216 bytes
Hello,
I am trying to find a way to time the execution of a script.  At this
time I have implemented something very simple that grabs the "time" in
seconds at the start of the scripts and grabs it again at the end,
compares them and prints out the time in seconds.

I am looking for a way to measure the execution time more accurately,
say in 10ths, 100ths, 1000ths etc. of a second.  Please help.

Thanks,

-Eddy
Re: Execution time in Perl
#641
Author: Jeremy D. Zawodny
Date: Wed, 29 Oct 1997 17:29
31 lines
1631 bytes
[cc'd automagically to original author]

On Wed, 29 Oct 1997 12:23:58 -0500, cjz <us011769@interramp.com>
wrote:

Please do not post to comp.lang.perl. It is a dead group.

>Hello,
>I am trying to find a way to time the execution of a script.  At this
>time I have implemented something very simple that grabs the "time" in
>seconds at the start of the scripts and grabs it again at the end,
>compares them and prints out the time in seconds.
>
>I am looking for a way to measure the execution time more accurately,
>say in 10ths, 100ths, 1000ths etc. of a second.  Please help.

If you're on a Unix platform, you may be able to use the 'time'
command to do that.

% time perl script.pl

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.
Re: Execution time in Perl
#642
Author: chds652
Date: Thu, 30 Oct 1997 08:51
22 lines
1532 bytes
cjz wrote:

> Hello,
> I am trying to find a way to time the execution of a script.  At this
> time I have implemented something very simple that grabs the "time" in
> seconds at the start of the scripts and grabs it again at the end,
> compares them and prints out the time in seconds.
>
> I am looking for a way to measure the execution time more accurately,
> say in 10ths, 100ths, 1000ths etc. of a second.  Please help.
>
> Thanks,
>
> -Eddy

Use the "times" function built into Perl.  This function can obtain user
time, system time, child time, and children's system time.

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

chds652@botcc.com
Re: Execution time in Perl
#644
Author: Mick Farmer
Date: Thu, 30 Oct 1997 17:41
8 lines
1074 bytes
Dear Eddy,

Try the Benchmark module in the standard library.  This
should do what you want.

Regards,

Mick
Re: Execution time in Perl
#643
Author: Scott Yanoff
Date: Mon, 03 Nov 1997 19:43
21 lines
1544 bytes
chds652 wrote:
> 
> cjz wrote:
> 
> > Hello,
> > I am trying to find a way to time the execution of a script.  At this
> > time I have implemented something very simple that grabs the "time" in
> > seconds at the start of the scripts and grabs it again at the end,
> > compares them and prints out the time in seconds.
> >
> > I am looking for a way to measure the execution time more accurately,
> > say in 10ths, 100ths, 1000ths etc. of a second.  Please help.

I think one other way you can do this, if you are on a UNIX platform and
running the PERL script by hand, is to put the word "time" before the
perl script:

$ time some_script.pl

The man page should have more info.
-Scott
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads