![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Average Time | sambond | UNIX for Dummies Questions & Answers | 1 | 01-16-2008 06: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 09:33 PM |
| time calculation | liux99 | UNIX for Advanced & Expert Users | 2 | 08-18-2005 07:33 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
Quote:
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. |
|
|||
|
Quote:
See my post above (after yours). Looks like we're on the same page now. Thanks for your input. |
|||
| Google UNIX.COM |