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 10:57 AM
average transaction time nhatch Shell Programming and Scripting 2 05-02-2007 09:11 AM
change time interval for /proc/loadavg calculation Rakesh Ranjan High Level Programming 2 05-12-2006 05:48 AM
script execution time calculation johnsonbryce Shell Programming and Scripting 9 02-25-2006 01:33 AM
time calculation liux99 UNIX for Advanced & Expert Users 2 08-18-2005 11:33 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-20-2008
Seawall Seawall is offline
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 08:59 AM.. Reason: typo
  #2 (permalink)  
Old 05-20-2008
agn agn is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 172
What do you mean by job completion time ? The time when a particular job was completed or time it took to complete a job ?
  #3 (permalink)  
Old 05-20-2008
Seawall Seawall is offline
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.
  #4 (permalink)  
Old 05-20-2008
agn agn is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 172
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.
  #5 (permalink)  
Old 05-20-2008
Seawall Seawall is offline
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.
  #6 (permalink)  
Old 05-20-2008
Seawall Seawall is offline
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0