1832595 Members
3137 Online
110043 Solutions
New Discussion

Millisecond time

 
Sirius Black
Regular Advisor

Millisecond time

Hi all,
I've to realize a shell script which have to take the time and milliseco nd to analyze how many time the script took for its execution..
Have you any idea ??
Fabrizio
6 REPLIES 6
Pedro Cirne
Esteemed Contributor

Re: Millisecond time

Hi,

Use "time <script>" or "timex <script>"

Enjoy :-)
harry d brown jr
Honored Contributor

Re: Millisecond time

timex

man timex

live free or die
harry d brown jr
Live Free or Die
Yogeeraj_1
Honored Contributor

Re: Millisecond time

hi,

have a look at the following threads:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=13885
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=122073
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=402167

hope this helps!
regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
A. Clay Stephenson
Acclaimed Contributor

Re: Millisecond time

The timex command (which will give you .01 second resolution) is about as good as you are going to get from the shell. It would be possible to write a small C program or Perl script to give better resolution but the overhead of doing a fork and exec to spawn the child timer process from the shell would completely overwhelm any millisecond accuracy that you were trying to achieve.
If it ain't broke, I can fix that.
Sirius Black
Regular Advisor

Re: Millisecond time

Hi,
I try with time ( not good) and timex ( so and so ) I've to take the millisecond time in order to evaluate how many time the process takes !!!
So there is a command, perl or sh which I can call at the start and the end of the script ??
Fabrizio
A. Clay Stephenson
Acclaimed Contributor

Re: Millisecond time

Perl's Time::HiRes module would do this easily BUT it would only make sense to use it within the same Perl script. As I tried to explain to you before, the overhead of spawning an additional process completely masks any millisecond accuracy that you hoped to achieve. From the shell, timex is your least evil choice although it would be quite trivial to write a Perl script that would return millisecond timestamps. The problem is that with the overhead of forking and execing the Perl script, you would really need to throw away at least 50 msec of accuracy.
If it ain't broke, I can fix that.