Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average Time between 2 events

Status
Not open for further replies.

metakith

Programmer
Apr 17, 2009
6
RO
Hello,

Could someone please give me an example on how to display the time between 2 events, and also the average time of multiple events?

ex: loop 100
Time1
EventZ
EventZ last for X seconds
Average time is y sec
endloop

Thanks in advance.
 
You can assign the value of $LTIME to a long variable before the script operation(s), then subtract that value from the current value of $LTIME to find the elapsed number of seconds. Something like this:

lStartTime = $LTIME
<your operations go here>
lStartTime = $LTIME - lStartTime will contain the number of seconds it took for the job to complete.

What kind of average are you trying to compute? For each run through the loop?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top