The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Average Time sambond UNIX for Dummies Questions & Answers 1 01-16-2008 07:57 AM
average transaction time nhatch Shell Programming and Scripting 2 05-02-2007 05:11 AM
change time interval for /proc/loadavg calculation Rakesh Ranjan High Level Programming 2 05-12-2006 01:48 AM
script execution time calculation johnsonbryce Shell Programming and Scripting 9 02-24-2006 10:33 PM
time calculation liux99 UNIX for Advanced & Expert Users 2 08-18-2005 07:33 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-20-2008
Registered User
 

Join Date: May 2008
Posts: 4
Question Average completion time calculation?

I've been trying all night to come up with a script that will take a file that contains job completion times like this as input:

18:30
17:45
16:39
18:01
17:50
...

and figure the Average completion time. I've tried several things, and I just can't seem to get it to figure correctly. I'm sure there is an easy way to do this, as I would assume that I'm not the first person that would require info like this, but for now, it's beyond me.

Also, one potential problem that I haven't even tried to tackle yet is what happens when the jobs finishes at say, 23:40 one night, and then at 00:15 the next night. The method I've been trying to perfect will return something like 11:45 as the average (pretty much 12 hours off).

Last edited by Seawall; 05-20-2008 at 04:59 AM. Reason: typo
Reply With Quote
Forum Sponsor
  #2  
Old 05-20-2008
agn agn is offline
Registered User
 

Join Date: Feb 2008
Posts: 97
What do you mean by job completion time ? The time when a particular job was completed or time it took to complete a job ?
Reply With Quote
  #3  
Old 05-20-2008
Registered User
 

Join Date: May 2008
Posts: 4
Sorry if I was too vague.

By job completion time I mean the actual time that the job completed.

My end goal is to set up a script that will alert me if a job runs X minutes past its average. First step is to calculate the average.
Reply With Quote
  #4  
Old 05-20-2008
agn agn is offline
Registered User
 

Join Date: Feb 2008
Posts: 97
So if the job starts/started at exactly the same time every day whats stopping you from finding the avg of the above values? Just cut the first fields (use ':' as delimiter). Find the sum. Divide by 60 to find the total minutes. Add up second fields on each line delimited by ':'.
Add the aboves sums and divide my the number of lines to get the avg. Divide by 60 to get the avg time when your script should end.
Reply With Quote
  #5  
Old 05-20-2008
Registered User
 

Join Date: May 2008
Posts: 4
Quote:
Originally Posted by agn View Post
What do you mean by job completion time ? The time when a particular job was completed or time it took to complete a job ?
Ah, that rings some bells with me.
I searched for my query before I posted the topic, and found several threads discussing how to figure the run time of a job.

Convert the time to seconds and subtract.

This should work for me too. Convert to minutes (HH*60+MM), add em all up, and divide by the # of values, then convert back to HH:MM.

However, that still will not work if a job finishes before midnight sometimes, and after midnight other times.

However, it is progress, and that is good.

I'll whip something up and post the code here to see if it can be improved upon, and to see if anyone has any ideas as to how to get around the midnight quandry.
Reply With Quote
  #6  
Old 05-20-2008
Registered User
 

Join Date: May 2008
Posts: 4
Quote:
Originally Posted by agn View Post
So if the job starts/started at exactly the same time every day whats stopping you from finding the avg of the above values? Just cut the first fields (use ':' as delimiter). Find the sum. Divide by 60 to find the total minutes. Add up second fields on each line delimited by ':'.
Add the aboves sums and divide my the number of lines to get the avg. Divide by 60 to get the avg time when your script should end.
Very few of the jobs start at the same time every day, but that's not really important.

See my post above (after yours). Looks like we're on the same page now.
Thanks for your input.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0