Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks

I have a program that I'm going to incorporate a timing mechanism into.

i.e. 150 iterations every 15 seconds etc.

Are there any modules that I should look at for this type of thing or should I simply use a sleep command?

Thanks!

Title edit by tye

  • Comment on Timing the running of 150 iterations each 15 seconds; just sleep?

Replies are listed 'Best First'.
Re: Timing
by BrowserUk (Patriarch) on Feb 10, 2003 at 17:32 UTC

    Depending quite what you mean by "timer" you may find Timer::HiRes or Benchmark::Timer useful.

    Be warned though, if your using ActiveState perl then some parts of Timer::HiRes don't work. Eg. ualarm.

    A little more information as to what your program will be doing, along with the systems(s) it's intended to run on would make it easier to make good suggestions.


    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re: Timing
by FoxtrotUniform (Prior) on Feb 10, 2003 at 19:10 UTC

    You may find the times function useful for figuring out how long each iteration takes.

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    The hell with paco, vote for Erudil!

Re: Timing
by powerman (Friar) on Feb 10, 2003 at 20:41 UTC